#error This file may only be included from Format.h.
#endif
+#include "folly/Traits.h"
+
namespace folly {
namespace detail {
const char (&repr)[256][2]) {
// 'v >>= 7, v >>= 1' is no more than a work around to get rid of shift size
// warning when Uint = uint8_t (it's false as v >= 256 implies sizeof(v) > 1).
- for (; v >= 256; v >>= 7, v >>= 1) {
+ for (; !less_than<unsigned, 256>(v); v >>= 7, v >>= 1) {
auto b = v & 0xff;
bufLen -= 2;
buffer[bufLen] = repr[b][0];
auto& repr = formatOctal;
// 'v >>= 7, v >>= 2' is no more than a work around to get rid of shift size
// warning when Uint = uint8_t (it's false as v >= 512 implies sizeof(v) > 1).
- for (; v >= 512; v >>= 7, v >>= 2) {
+ for (; !less_than<unsigned, 512>(v); v >>= 7, v >>= 2) {
auto b = v & 0x1ff;
bufLen -= 3;
buffer[bufLen] = repr[b][0];
UT uval;
char sign;
if (std::is_signed<T>::value) {
- if (val_ < 0) {
+ if (folly::is_negative(val_)) {
uval = static_cast<UT>(-val_);
sign = '-';
} else {
arg.precision = 6;
}
- bool done = false;
-
// 2+: for null terminator and optional sign shenanigans.
char buf[2 + std::max({
(2 + DoubleToStringConverter::kMaxFixedDigitsBeforePoint +