diff --git a/Utilities/StrFmt.cpp b/Utilities/StrFmt.cpp index 7678041cd8..a8c77bcc3d 100644 --- a/Utilities/StrFmt.cpp +++ b/Utilities/StrFmt.cpp @@ -252,7 +252,7 @@ struct fmt::cfmt_src template T get(std::size_t index) const { - return reinterpret_cast(args[index]); + return *reinterpret_cast(reinterpret_cast(args + index)); } void skip(std::size_t extra) diff --git a/Utilities/StrFmt.h b/Utilities/StrFmt.h index 2b21a35abe..131aa7152a 100644 --- a/Utilities/StrFmt.h +++ b/Utilities/StrFmt.h @@ -60,9 +60,9 @@ struct fmt_unveil::value && sizeof using type = T; // Convert FP to f64 and reinterpret (TODO?) - static inline u64 get(f64 arg) + static inline u64 get(const f64 arg) { - return reinterpret_cast(arg); + return *reinterpret_cast(reinterpret_cast(&arg)); } }; diff --git a/Utilities/cfmt.h b/Utilities/cfmt.h index 05bd5c13bf..3fe0002d66 100644 --- a/Utilities/cfmt.h +++ b/Utilities/cfmt.h @@ -581,7 +581,7 @@ std::size_t cfmt_append(Dst& out, const Char* fmt, Src&& src) const std::string _fmt(fmt - ctx.size, fmt); - const u64 arg0 = src.template get(0); + const f64 arg0 = src.template get(0); const u64 arg1 = ctx.args >= 1 ? src.template get(1) : 0; const u64 arg2 = ctx.args >= 2 ? src.template get(2) : 0;