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 };
58 static void VerifyValue(
T value,
void(*f)(
T,
char*),
char* (*g)(
T,
char*)) {
63 *g(
value, buffer2) =
'\0';
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');
115 u32toa_naive(u, buffer);
122 *p++ =
static_cast<char>(char(
value % 10) +
'0');
139 u64toa_naive(u, buffer);
143 Verify(u32toa_naive,
u32toa);
147 Verify(i32toa_naive,
i32toa);
151 Verify(u64toa_naive,
u64toa);
155 Verify(i64toa_naive,
i64toa);
char * u64toa(uint64_t value, char *buffer)
#define EXPECT_STREQ(s1, s2)
unsigned __int64 uint64_t
char * u32toa(uint32_t value, char *buffer)
static int64_t Negate(int64_t x)
static uint32_t Negate(uint32_t x)
const GenericPointer< typename T::ValueType > T2 value
static int32_t Negate(int32_t x)
char * i64toa(int64_t value, char *buffer)
char * i32toa(int32_t value, char *buffer)
static uint64_t Negate(uint64_t x)