diff --git a/src/ArduinoJson/Numbers/FloatTraits.hpp b/src/ArduinoJson/Numbers/FloatTraits.hpp
index cd7fdf01..6e1cd1bb 100644
--- a/src/ArduinoJson/Numbers/FloatTraits.hpp
+++ b/src/ArduinoJson/Numbers/FloatTraits.hpp
@@ -29,21 +29,6 @@ struct FloatTraits {
typedef int16_t exponent_type;
static const exponent_type exponent_max = 308;
- template
- static T make_float(T m, TExponent e) {
- auto powersOfTen =
- e > 0 ? positiveBinaryPowersOfTen() : negativeBinaryPowersOfTen();
- if (e <= 0)
- e = TExponent(-e);
-
- for (uint8_t index = 0; e != 0; index++) {
- if (e & 1)
- m *= powersOfTen[index];
- e >>= 1;
- }
- return m;
- }
-
static pgm_ptr positiveBinaryPowersOfTen() {
ARDUINOJSON_DEFINE_PROGMEM_ARRAY( //
uint64_t, factors,
@@ -145,21 +130,6 @@ struct FloatTraits {
typedef int8_t exponent_type;
static const exponent_type exponent_max = 38;
- template
- static T make_float(T m, TExponent e) {
- auto powersOfTen =
- e > 0 ? positiveBinaryPowersOfTen() : negativeBinaryPowersOfTen();
- if (e <= 0)
- e = TExponent(-e);
-
- for (uint8_t index = 0; e != 0; index++) {
- if (e & 1)
- m *= powersOfTen[index];
- e >>= 1;
- }
- return m;
- }
-
static pgm_ptr positiveBinaryPowersOfTen() {
ARDUINOJSON_DEFINE_PROGMEM_ARRAY(uint32_t, factors,
{
@@ -252,4 +222,21 @@ struct FloatTraits {
}
};
+template
+inline TFloat make_float(TFloat m, TExponent e) {
+ using traits = FloatTraits;
+
+ auto powersOfTen = e > 0 ? traits::positiveBinaryPowersOfTen()
+ : traits::negativeBinaryPowersOfTen();
+ if (e <= 0)
+ e = TExponent(-e);
+
+ for (uint8_t index = 0; e != 0; index++) {
+ if (e & 1)
+ m *= powersOfTen[index];
+ e >>= 1;
+ }
+ return m;
+}
+
ARDUINOJSON_END_PRIVATE_NAMESPACE
diff --git a/src/ArduinoJson/Numbers/parseNumber.hpp b/src/ArduinoJson/Numbers/parseNumber.hpp
index 97402362..660f4287 100644
--- a/src/ArduinoJson/Numbers/parseNumber.hpp
+++ b/src/ArduinoJson/Numbers/parseNumber.hpp
@@ -137,7 +137,7 @@ inline bool parseNumber(const char* s, VariantData& result) {
return false;
JsonFloat final_result =
- traits::make_float(static_cast(mantissa), exponent);
+ make_float(static_cast(mantissa), exponent);
result.setFloat(is_negative ? -final_result : final_result);
return true;