8000 Remove `negativeBinaryPowersOfTenPlusOne` · smartcoder00/ArduinoJson@42ae8c3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 42ae8c3

Browse files
committed
Remove negativeBinaryPowersOfTenPlusOne
1 parent 319ecec commit 42ae8c3

File tree

2 files changed

+1
-31
lines changed

2 files changed

+1
-31
lines changed

src/ArduinoJson/Numbers/FloatParts.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ struct FloatParts {
7373

7474
if (value > 0 && value <= ARDUINOJSON_NEGATIVE_EXPONENTIATION_THRESHOLD) {
7575
for (; index >= 0; index--) {
76-
if (value < traits::negativeBinaryPowersOfTenPlusOne()[index]) {
76+
if (value < traits::negativeBinaryPowersOfTen()[index] * 10) {
7777
value *= traits::positiveBinaryPowersOfTen()[index];
7878
powersOf10 = int16_t(powersOf10 - bit);
7979
}

src/ArduinoJson/Numbers/FloatTraits.hpp

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -63,23 +63,6 @@ struct FloatTraits<T, 8 /*64bits*/> {
6363
return pgm_ptr<T>(reinterpret_cast<const T*>(factors));
6464
}
6565

66-
static pgm_ptr<T> negativeBinaryPowersOfTenPlusOne() {
67-
ARDUINOJSON_DEFINE_PROGMEM_ARRAY( //
68-
uint64_t, factors,
69-
{
70-
0x3FF0000000000000, // 1e0
71-
0x3FB999999999999A, // 1e-1
72-
0x3F50624DD2F1A9FC, // 1e-3
73-
0x3E7AD7F29ABCAF48, // 1e-7
74-
0x3CD203AF9EE75616, // 1e-15
75-
0x398039D665896880, // 1e-31
76-
0x32DA53FC9631D10D, // 1e-63
77-
0x2591544581B7DEC2, // 1e-127
78-
0x0AFE07B27DD78B14 // 1e-255
79-
});
80-
return pgm_ptr<T>(reinterpret_cast<const T*>(factors));
81-
}
82-
8366
static T nan() {
8467
return forge(0x7ff8000000000000);
8568
}
@@ -156,19 +139,6 @@ struct FloatTraits<T, 4 /*32bits*/> {
156139
return pgm_ptr<T>(reinterpret_cast<const T*>(factors));
157140
}
158141

159-
static pgm_ptr<T> negativeBinaryPowersOfTenPlusOne() {
160-
ARDUINOJSON_DEFINE_PROGMEM_ARRAY(uint32_t, factors,
161-
{
162-
0x3f800000, // 1e0f
163-
0x3dcccccd, // 1e-1f
164-
0x3a83126f, // 1e-3f
165-
0x33d6bf95, // 1e-7f
166-
0x26901d7d, // 1e-15f
167-
0x0c01ceb3 // 1e-31f
168-
});
169-
return pgm_ptr<T>(reinterpret_cast<const T*>(factors));
170-
}
171-
172142
static T forge(uint32_t bits) {
173143
return alias_cast<T>(bits);
174144
}

0 commit comments

Comments
 (0)
0