turn implicit integer conversions into static_casts to avoid -Wconversion warnings
This commit is contained in:
parent
ca9b2d188f
commit
b9608f2cf2
@ -53,7 +53,7 @@ struct DiyFp {
|
|||||||
uint64_t u64;
|
uint64_t u64;
|
||||||
} u = { d };
|
} u = { d };
|
||||||
|
|
||||||
int biased_e = (u.u64 & kDpExponentMask) >> kDpSignificandSize;
|
int biased_e = static_cast<int>((u.u64 & kDpExponentMask) >> kDpSignificandSize);
|
||||||
uint64_t significand = (u.u64 & kDpSignificandMask);
|
uint64_t significand = (u.u64 & kDpSignificandMask);
|
||||||
if (biased_e != 0) {
|
if (biased_e != 0) {
|
||||||
f = significand + kDpHiddenBit;
|
f = significand + kDpHiddenBit;
|
||||||
@ -78,7 +78,7 @@ struct DiyFp {
|
|||||||
return DiyFp(h, e + rhs.e + 64);
|
return DiyFp(h, e + rhs.e + 64);
|
||||||
#elif (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) && defined(__x86_64__)
|
#elif (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) && defined(__x86_64__)
|
||||||
unsigned __int128 p = static_cast<unsigned __int128>(f) * static_cast<unsigned __int128>(rhs.f);
|
unsigned __int128 p = static_cast<unsigned __int128>(f) * static_cast<unsigned __int128>(rhs.f);
|
||||||
uint64_t h = p >> 64;
|
uint64_t h = static_cast<uint64_t>(p >> 64);
|
||||||
uint64_t l = static_cast<uint64_t>(p);
|
uint64_t l = static_cast<uint64_t>(p);
|
||||||
if (l & (uint64_t(1) << 63)) // rounding
|
if (l & (uint64_t(1) << 63)) // rounding
|
||||||
h++;
|
h++;
|
||||||
@ -284,7 +284,7 @@ inline void DigitGen(const DiyFp& W, const DiyFp& Mp, uint64_t delta, char* buff
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (d || *len)
|
if (d || *len)
|
||||||
buffer[(*len)++] = '0' + static_cast<char>(d);
|
buffer[(*len)++] = static_cast<char>('0' + static_cast<char>(d));
|
||||||
kappa--;
|
kappa--;
|
||||||
uint64_t tmp = (static_cast<uint64_t>(p1) << -one.e) + p2;
|
uint64_t tmp = (static_cast<uint64_t>(p1) << -one.e) + p2;
|
||||||
if (tmp <= delta) {
|
if (tmp <= delta) {
|
||||||
@ -300,7 +300,7 @@ inline void DigitGen(const DiyFp& W, const DiyFp& Mp, uint64_t delta, char* buff
|
|||||||
delta *= 10;
|
delta *= 10;
|
||||||
char d = static_cast<char>(p2 >> -one.e);
|
char d = static_cast<char>(p2 >> -one.e);
|
||||||
if (d || *len)
|
if (d || *len)
|
||||||
buffer[(*len)++] = '0' + d;
|
buffer[(*len)++] = static_cast<char>('0' + d);
|
||||||
p2 &= one.f - 1;
|
p2 &= one.f - 1;
|
||||||
kappa--;
|
kappa--;
|
||||||
if (p2 < delta) {
|
if (p2 < delta) {
|
||||||
@ -332,7 +332,7 @@ inline char* WriteExponent(int K, char* buffer) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (K >= 100) {
|
if (K >= 100) {
|
||||||
*buffer++ = '0' + static_cast<char>(K / 100);
|
*buffer++ = static_cast<char>('0' + static_cast<char>(K / 100));
|
||||||
K %= 100;
|
K %= 100;
|
||||||
const char* d = GetDigitsLut() + K * 2;
|
const char* d = GetDigitsLut() + K * 2;
|
||||||
*buffer++ = d[0];
|
*buffer++ = d[0];
|
||||||
@ -344,7 +344,7 @@ inline char* WriteExponent(int K, char* buffer) {
|
|||||||
*buffer++ = d[1];
|
*buffer++ = d[1];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
*buffer++ = '0' + static_cast<char>(K);
|
*buffer++ = static_cast<char>('0' + static_cast<char>(K));
|
||||||
|
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ inline char* u32toa(uint32_t value, char* buffer) {
|
|||||||
*buffer++ = cDigitsLut[i + 1];
|
*buffer++ = cDigitsLut[i + 1];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
*buffer++ = '0' + static_cast<char>(a);
|
*buffer++ = static_cast<char>('0' + static_cast<char>(a));
|
||||||
|
|
||||||
const uint32_t b = value / 10000; // 0 to 9999
|
const uint32_t b = value / 10000; // 0 to 9999
|
||||||
const uint32_t c = value % 10000; // 0 to 9999
|
const uint32_t c = value % 10000; // 0 to 9999
|
||||||
@ -227,14 +227,14 @@ inline char* u64toa(uint64_t value, char* buffer) {
|
|||||||
value %= kTen16;
|
value %= kTen16;
|
||||||
|
|
||||||
if (a < 10)
|
if (a < 10)
|
||||||
*buffer++ = '0' + static_cast<char>(a);
|
*buffer++ = static_cast<char>('0' + static_cast<char>(a));
|
||||||
else if (a < 100) {
|
else if (a < 100) {
|
||||||
const uint32_t i = a << 1;
|
const uint32_t i = a << 1;
|
||||||
*buffer++ = cDigitsLut[i];
|
*buffer++ = cDigitsLut[i];
|
||||||
*buffer++ = cDigitsLut[i + 1];
|
*buffer++ = cDigitsLut[i + 1];
|
||||||
}
|
}
|
||||||
else if (a < 1000) {
|
else if (a < 1000) {
|
||||||
*buffer++ = '0' + static_cast<char>(a / 100);
|
*buffer++ = static_cast<char>('0' + static_cast<char>(a / 100));
|
||||||
|
|
||||||
const uint32_t i = (a % 100) << 1;
|
const uint32_t i = (a % 100) << 1;
|
||||||
*buffer++ = cDigitsLut[i];
|
*buffer++ = cDigitsLut[i];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user