20 RAPIDJSON_DIAG_OFF(type-limits)
31 enum { kBufferSize = 11 };
32 enum { kMaxDigit = 10 };
38 enum { kBufferSize = 12 };
39 enum { kMaxDigit = 10 };
45 enum { kBufferSize = 21 };
46 enum { kMaxDigit = 20 };
52 enum { kBufferSize = 22 };
53 enum { kMaxDigit = 20 };
63 *g(value, buffer2) =
'\0';
66 EXPECT_STREQ(buffer1, buffer2);
70 static void Verify(
void(*f)(
T,
char*),
char* (*g)(
T,
char*)) {
72 VerifyValue<T>(0,
f, g);
73 VerifyValue<T>(std::numeric_limits<T>::min(), f, g);
74 VerifyValue<T>(std::numeric_limits<T>::max(), f, g);
77 for (
int power = 2; power <= 10; power += 8) {
80 VerifyValue<T>(i - 1, f, g);
81 VerifyValue<T>(i, f, g);
82 if (std::numeric_limits<T>::min() < 0) {
87 if (i > static_cast<T>(std::numeric_limits<T>::max() / static_cast<T>(power)))
89 i *=
static_cast<T>(power);
98 *p++ =
static_cast<char>(char(value % 10) +
'0');
122 *p++ =
static_cast<char>(char(value % 10) +
'0');
static void u64toa_naive(uint64_t value, char *buffer)
char * u64toa(uint64_t value, char *buffer)
static uint32_t Negate(uint32_t x)
static void VerifyValue(T value, void(*f)(T, char *), char *(*g)(T, char *))
static uint64_t Negate(uint64_t x)
static int32_t Negate(int32_t x)
unsigned __int64 uint64_t
static void i64toa_naive(int64_t value, char *buffer)
static void i32toa_naive(int32_t value, char *buffer)
char * u32toa(uint32_t value, char *buffer)
const GenericPointer< typename T::ValueType > T2 value
static int64_t Negate(int64_t x)
static void Verify(void(*f)(T, char *), char *(*g)(T, char *))
char * i64toa(int64_t value, char *buffer)
char * i32toa(int32_t value, char *buffer)
static void u32toa_naive(uint32_t value, char *buffer)