diff --git a/loader/include/Geode/utils/general.hpp b/loader/include/Geode/utils/general.hpp index 27844896..c00a258b 100644 --- a/loader/include/Geode/utils/general.hpp +++ b/loader/include/Geode/utils/general.hpp @@ -5,7 +5,6 @@ #include "../DefaultInclude.hpp" #include #include -#include #include #include #include @@ -64,9 +63,7 @@ namespace geode { template std::string intToHex(T i) { - std::stringstream stream; - stream << std::showbase << std::setbase(16) << (uint64_t)i; - return stream.str(); + return fmt::format("{:#x}", i); } /** @@ -75,15 +72,16 @@ namespace geode { * @param num Number to convert to string * @param precision Precision of the converted number * @returns Number as string + * @note Precision has no effect on integers */ template std::string numToString(Num num, size_t precision = 0) { - std::stringstream ss; - if (precision) { - ss << std::fixed << std::setprecision(precision); + if constexpr (std::is_floating_point_v) { + if (precision) { + return fmt::format("{:.{}f}", num, precision); + } } - ss << num; - return ss.str(); + return fmt::to_string(num); } /**