From abda377808079b474b3ae0c940c6254570073e81 Mon Sep 17 00:00:00 2001 From: Drath Date: Fri, 2 Jan 2026 12:43:53 +0100 Subject: [PATCH] speed ts up --- include/utils.hpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/utils.hpp b/include/utils.hpp index 8f8bd79..e765aad 100644 --- a/include/utils.hpp +++ b/include/utils.hpp @@ -1,11 +1,10 @@ #ifndef UTILS_HPP #define UTILS_HPP - +#include #include #include #include -#include #include namespace utils { @@ -39,9 +38,12 @@ inline void fastReadNum(const std::string& path, char (&buf)[N], T& result) { } inline std::string pNum(const auto num, const uint8_t decs = 0) { - return std::format("{:.{}f}", num, decs); + static std::array buf; + auto [ptr, ec] = std::to_chars(buf.data(), buf.data() + buf.size(), num, std::chars_format::fixed, decs); + return std::string(buf.data(), ptr); } + inline bool fileExists(const std::string_view& path) { return std::filesystem::exists(path); }