Use KQU() rather than QU() where applicable.
Fix KZI() and KQI() to append LL rather than ULL.
This commit is contained in:
parent
d04047cc29
commit
1f6d77e1f6
@ -76,9 +76,9 @@ hash_fmix_64(uint64_t k)
|
||||
{
|
||||
|
||||
k ^= k >> 33;
|
||||
k *= QU(0xff51afd7ed558ccdULL);
|
||||
k *= KQU(0xff51afd7ed558ccd);
|
||||
k ^= k >> 33;
|
||||
k *= QU(0xc4ceb9fe1a85ec53ULL);
|
||||
k *= KQU(0xc4ceb9fe1a85ec53);
|
||||
k ^= k >> 33;
|
||||
|
||||
return (k);
|
||||
@ -247,8 +247,8 @@ hash_x64_128(const void *key, const int len, const uint32_t seed,
|
||||
uint64_t h1 = seed;
|
||||
uint64_t h2 = seed;
|
||||
|
||||
const uint64_t c1 = QU(0x87c37b91114253d5ULL);
|
||||
const uint64_t c2 = QU(0x4cf5ad432745937fULL);
|
||||
const uint64_t c1 = KQU(0x87c37b91114253d5);
|
||||
const uint64_t c2 = KQU(0x4cf5ad432745937f);
|
||||
|
||||
/* body */
|
||||
{
|
||||
|
@ -44,9 +44,9 @@
|
||||
#define QI(q) ((int64_t)q)
|
||||
|
||||
#define KZU(z) ZU(z##ULL)
|
||||
#define KZI(z) ZI(z##ULL)
|
||||
#define KZI(z) ZI(z##LL)
|
||||
#define KQU(q) QU(q##ULL)
|
||||
#define KQI(q) QI(q##ULL)
|
||||
#define KQI(q) QI(q##LL)
|
||||
|
||||
#ifndef __DECONST
|
||||
# define __DECONST(type, var) ((type)(uintptr_t)(const void *)(var))
|
||||
|
@ -511,7 +511,7 @@ uint64_t gen_rand64(sfmt_t *ctx) {
|
||||
uint64_t gen_rand64_range(sfmt_t *ctx, uint64_t limit) {
|
||||
uint64_t ret, above;
|
||||
|
||||
above = 0xffffffffffffffffULL - (0xffffffffffffffffULL % limit);
|
||||
above = KQU(0xffffffffffffffff) - (KQU(0xffffffffffffffff) % limit);
|
||||
while (1) {
|
||||
ret = gen_rand64(ctx);
|
||||
if (ret < above) {
|
||||
|
2000
test/unit/SFMT.c
2000
test/unit/SFMT.c
File diff suppressed because it is too large
Load Diff
@ -52,8 +52,8 @@ TEST_BEGIN(test_malloc_strtoumax)
|
||||
const char *expected_errno_name;
|
||||
uintmax_t expected_x;
|
||||
};
|
||||
#define ERR(e) e, #e
|
||||
#define UMAX(x) ((uintmax_t)x##ULL)
|
||||
#define ERR(e) e, #e
|
||||
#define KUMAX(x) ((uintmax_t)x##ULL)
|
||||
struct test_s tests[] = {
|
||||
{"0", "0", -1, ERR(EINVAL), UINTMAX_MAX},
|
||||
{"0", "0", 1, ERR(EINVAL), UINTMAX_MAX},
|
||||
@ -64,51 +64,51 @@ TEST_BEGIN(test_malloc_strtoumax)
|
||||
{"++3", "++3", 0, ERR(EINVAL), UINTMAX_MAX},
|
||||
{"-", "-", 0, ERR(EINVAL), UINTMAX_MAX},
|
||||
|
||||
{"42", "", 0, ERR(0), UMAX(42)},
|
||||
{"+42", "", 0, ERR(0), UMAX(42)},
|
||||
{"-42", "", 0, ERR(0), UMAX(-42)},
|
||||
{"042", "", 0, ERR(0), UMAX(042)},
|
||||
{"+042", "", 0, ERR(0), UMAX(042)},
|
||||
{"-042", "", 0, ERR(0), UMAX(-042)},
|
||||
{"0x42", "", 0, ERR(0), UMAX(0x42)},
|
||||
{"+0x42", "", 0, ERR(0), UMAX(0x42)},
|
||||
{"-0x42", "", 0, ERR(0), UMAX(-0x42)},
|
||||
{"42", "", 0, ERR(0), KUMAX(42)},
|
||||
{"+42", "", 0, ERR(0), KUMAX(42)},
|
||||
{"-42", "", 0, ERR(0), KUMAX(-42)},
|
||||
{"042", "", 0, ERR(0), KUMAX(042)},
|
||||
{"+042", "", 0, ERR(0), KUMAX(042)},
|
||||
{"-042", "", 0, ERR(0), KUMAX(-042)},
|
||||
{"0x42", "", 0, ERR(0), KUMAX(0x42)},
|
||||
{"+0x42", "", 0, ERR(0), KUMAX(0x42)},
|
||||
{"-0x42", "", 0, ERR(0), KUMAX(-0x42)},
|
||||
|
||||
{"0", "", 0, ERR(0), UMAX(0)},
|
||||
{"1", "", 0, ERR(0), UMAX(1)},
|
||||
{"0", "", 0, ERR(0), KUMAX(0)},
|
||||
{"1", "", 0, ERR(0), KUMAX(1)},
|
||||
|
||||
{"42", "", 0, ERR(0), UMAX(42)},
|
||||
{" 42", "", 0, ERR(0), UMAX(42)},
|
||||
{"42 ", " ", 0, ERR(0), UMAX(42)},
|
||||
{"0x", "x", 0, ERR(0), UMAX(0)},
|
||||
{"42x", "x", 0, ERR(0), UMAX(42)},
|
||||
{"42", "", 0, ERR(0), KUMAX(42)},
|
||||
{" 42", "", 0, ERR(0), KUMAX(42)},
|
||||
{"42 ", " ", 0, ERR(0), KUMAX(42)},
|
||||
{"0x", "x", 0, ERR(0), KUMAX(0)},
|
||||
{"42x", "x", 0, ERR(0), KUMAX(42)},
|
||||
|
||||
{"07", "", 0, ERR(0), UMAX(7)},
|
||||
{"010", "", 0, ERR(0), UMAX(8)},
|
||||
{"08", "8", 0, ERR(0), UMAX(0)},
|
||||
{"0_", "_", 0, ERR(0), UMAX(0)},
|
||||
{"07", "", 0, ERR(0), KUMAX(7)},
|
||||
{"010", "", 0, ERR(0), KUMAX(8)},
|
||||
{"08", "8", 0, ERR(0), KUMAX(0)},
|
||||
{"0_", "_", 0, ERR(0), KUMAX(0)},
|
||||
|
||||
{"0x", "x", 0, ERR(0), UMAX(0)},
|
||||
{"0X", "X", 0, ERR(0), UMAX(0)},
|
||||
{"0xg", "xg", 0, ERR(0), UMAX(0)},
|
||||
{"0XA", "", 0, ERR(0), UMAX(10)},
|
||||
{"0x", "x", 0, ERR(0), KUMAX(0)},
|
||||
{"0X", "X", 0, ERR(0), KUMAX(0)},
|
||||
{"0xg", "xg", 0, ERR(0), KUMAX(0)},
|
||||
{"0XA", "", 0, ERR(0), KUMAX(10)},
|
||||
|
||||
{"010", "", 10, ERR(0), UMAX(10)},
|
||||
{"0x3", "x3", 10, ERR(0), UMAX(0)},
|
||||
{"010", "", 10, ERR(0), KUMAX(10)},
|
||||
{"0x3", "x3", 10, ERR(0), KUMAX(0)},
|
||||
|
||||
{"12", "2", 2, ERR(0), UMAX(1)},
|
||||
{"78", "8", 8, ERR(0), UMAX(7)},
|
||||
{"9a", "a", 10, ERR(0), UMAX(9)},
|
||||
{"9A", "A", 10, ERR(0), UMAX(9)},
|
||||
{"fg", "g", 16, ERR(0), UMAX(15)},
|
||||
{"FG", "G", 16, ERR(0), UMAX(15)},
|
||||
{"0xfg", "g", 16, ERR(0), UMAX(15)},
|
||||
{"0XFG", "G", 16, ERR(0), UMAX(15)},
|
||||
{"z_", "_", 36, ERR(0), UMAX(35)},
|
||||
{"Z_", "_", 36, ERR(0), UMAX(35)}
|
||||
{"12", "2", 2, ERR(0), KUMAX(1)},
|
||||
{"78", "8", 8, ERR(0), KUMAX(7)},
|
||||
{"9a", "a", 10, ERR(0), KUMAX(9)},
|
||||
{"9A", "A", 10, ERR(0), KUMAX(9)},
|
||||
{"fg", "g", 16, ERR(0), KUMAX(15)},
|
||||
{"FG", "G", 16, ERR(0), KUMAX(15)},
|
||||
{"0xfg", "g", 16, ERR(0), KUMAX(15)},
|
||||
{"0XFG", "G", 16, ERR(0), KUMAX(15)},
|
||||
{"z_", "_", 36, ERR(0), KUMAX(35)},
|
||||
{"Z_", "_", 36, ERR(0), KUMAX(35)}
|
||||
};
|
||||
#undef ERR
|
||||
#undef UMAX
|
||||
#undef KUMAX
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < sizeof(tests)/sizeof(struct test_s); i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user