diff options
-rw-r--r-- | src/lib/cc/compat_compiler.h | 2 | ||||
-rw-r--r-- | src/lib/intmath/bits.c | 16 | ||||
-rw-r--r-- | src/lib/wallclock/tor_gettimeofday.c | 8 | ||||
-rw-r--r-- | src/or/config.c | 4 | ||||
-rw-r--r-- | src/or/config.h | 4 | ||||
-rw-r--r-- | src/or/confparse.c | 18 | ||||
-rw-r--r-- | src/or/dirauth/dirvote.c | 12 | ||||
-rw-r--r-- | src/or/policies.c | 6 | ||||
-rw-r--r-- | src/or/routerparse.c | 2 | ||||
-rw-r--r-- | src/test/test_bwmgt.c | 2 | ||||
-rw-r--r-- | src/test/test_channel.c | 2 | ||||
-rw-r--r-- | src/test/test_circuitmux.c | 2 | ||||
-rw-r--r-- | src/test/test_config.c | 4 | ||||
-rw-r--r-- | src/test/test_crypto.c | 10 | ||||
-rw-r--r-- | src/test/test_dir.c | 10 | ||||
-rw-r--r-- | src/test/test_mainloop.c | 4 | ||||
-rw-r--r-- | src/test/test_options.c | 2 | ||||
-rw-r--r-- | src/test/test_status.c | 2 | ||||
-rw-r--r-- | src/test/test_util.c | 24 | ||||
-rw-r--r-- | src/test/test_util_format.c | 4 |
20 files changed, 68 insertions, 70 deletions
diff --git a/src/lib/cc/compat_compiler.h b/src/lib/cc/compat_compiler.h index a043ae809c..f14e48813e 100644 --- a/src/lib/cc/compat_compiler.h +++ b/src/lib/cc/compat_compiler.h @@ -189,9 +189,7 @@ #endif #define U64_PRINTF_ARG(a) ((uint64_t)a) -#define U64_LITERAL(n) UINT64_C(n) #define I64_PRINTF_ARG(a) ((int64_t)a) -#define I64_LITERAL(n) INT64_C(n) #define U64_FORMAT "%"PRIu64 #define I64_FORMAT "%"PRId64 diff --git a/src/lib/intmath/bits.c b/src/lib/intmath/bits.c index 4b5729e99a..7da524449d 100644 --- a/src/lib/intmath/bits.c +++ b/src/lib/intmath/bits.c @@ -16,27 +16,27 @@ int tor_log2(uint64_t u64) { int r = 0; - if (u64 >= (U64_LITERAL(1)<<32)) { + if (u64 >= (UINT64_C(1)<<32)) { u64 >>= 32; r = 32; } - if (u64 >= (U64_LITERAL(1)<<16)) { + if (u64 >= (UINT64_C(1)<<16)) { u64 >>= 16; r += 16; } - if (u64 >= (U64_LITERAL(1)<<8)) { + if (u64 >= (UINT64_C(1)<<8)) { u64 >>= 8; r += 8; } - if (u64 >= (U64_LITERAL(1)<<4)) { + if (u64 >= (UINT64_C(1)<<4)) { u64 >>= 4; r += 4; } - if (u64 >= (U64_LITERAL(1)<<2)) { + if (u64 >= (UINT64_C(1)<<2)) { u64 >>= 2; r += 2; } - if (u64 >= (U64_LITERAL(1)<<1)) { + if (u64 >= (UINT64_C(1)<<1)) { // u64 >>= 1; // not using this any more. r += 1; } @@ -55,12 +55,12 @@ round_to_power_of_2(uint64_t u64) return 1; lg2 = tor_log2(u64); - low = U64_LITERAL(1) << lg2; + low = UINT64_C(1) << lg2; if (lg2 == 63) return low; - high = U64_LITERAL(1) << (lg2+1); + high = UINT64_C(1) << (lg2+1); if (high - u64 < u64 - low) return high; else diff --git a/src/lib/wallclock/tor_gettimeofday.c b/src/lib/wallclock/tor_gettimeofday.c index 74a6405720..eb902e681d 100644 --- a/src/lib/wallclock/tor_gettimeofday.c +++ b/src/lib/wallclock/tor_gettimeofday.c @@ -44,10 +44,10 @@ tor_gettimeofday, (struct timeval *timeval)) #ifdef _WIN32 /* Epoch bias copied from perl: number of units between windows epoch and * Unix epoch. */ -#define EPOCH_BIAS U64_LITERAL(116444736000000000) -#define UNITS_PER_SEC U64_LITERAL(10000000) -#define USEC_PER_SEC U64_LITERAL(1000000) -#define UNITS_PER_USEC U64_LITERAL(10) +#define EPOCH_BIAS UINT64_C(116444736000000000) +#define UNITS_PER_SEC UINT64_C(10000000) +#define USEC_PER_SEC UINT64_C(1000000) +#define UNITS_PER_USEC UINT64_C(10) union { uint64_t ft_64; FILETIME ft_ft; diff --git a/src/or/config.c b/src/or/config.c index e3a4faa311..c958706f4c 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -4581,8 +4581,8 @@ compute_real_max_mem_in_queues(const uint64_t val, int log_guess) uint64_t result; if (val == 0) { -#define ONE_GIGABYTE (U64_LITERAL(1) << 30) -#define ONE_MEGABYTE (U64_LITERAL(1) << 20) +#define ONE_GIGABYTE (UINT64_C(1) << 30) +#define ONE_MEGABYTE (UINT64_C(1) << 20) /* The user didn't pick a memory limit. Choose a very large one * that is still smaller than the system memory */ static int notice_sent = 0; diff --git a/src/or/config.h b/src/or/config.h index d2faf6c512..75470a9c93 100644 --- a/src/or/config.h +++ b/src/or/config.h @@ -24,9 +24,9 @@ /** Maximum default value for MaxMemInQueues, in bytes. */ #if SIZEOF_VOID_P >= 8 -#define MAX_DEFAULT_MEMORY_QUEUE_SIZE (U64_LITERAL(8) << 30) +#define MAX_DEFAULT_MEMORY_QUEUE_SIZE (UINT64_C(8) << 30) #else -#define MAX_DEFAULT_MEMORY_QUEUE_SIZE (U64_LITERAL(2) << 30) +#define MAX_DEFAULT_MEMORY_QUEUE_SIZE (UINT64_C(2) << 30) #endif MOCK_DECL(const char*, get_dirportfrontpage, (void)); diff --git a/src/or/confparse.c b/src/or/confparse.c index b38e06c6a2..c152fb171f 100644 --- a/src/or/confparse.c +++ b/src/or/confparse.c @@ -1040,15 +1040,15 @@ static struct unit_table_t memory_units[] = { { "gigabit", 1<<27 }, { "gbits", 1<<27 }, { "gbit", 1<<27 }, - { "tb", U64_LITERAL(1)<<40 }, - { "tbyte", U64_LITERAL(1)<<40 }, - { "tbytes", U64_LITERAL(1)<<40 }, - { "terabyte", U64_LITERAL(1)<<40 }, - { "terabytes", U64_LITERAL(1)<<40 }, - { "terabits", U64_LITERAL(1)<<37 }, - { "terabit", U64_LITERAL(1)<<37 }, - { "tbits", U64_LITERAL(1)<<37 }, - { "tbit", U64_LITERAL(1)<<37 }, + { "tb", UINT64_C(1)<<40 }, + { "tbyte", UINT64_C(1)<<40 }, + { "tbytes", UINT64_C(1)<<40 }, + { "terabyte", UINT64_C(1)<<40 }, + { "terabytes", UINT64_C(1)<<40 }, + { "terabits", UINT64_C(1)<<37 }, + { "terabit", UINT64_C(1)<<37 }, + { "tbits", UINT64_C(1)<<37 }, + { "tbit", UINT64_C(1)<<37 }, { NULL, 0 }, }; diff --git a/src/or/dirauth/dirvote.c b/src/or/dirauth/dirvote.c index 85a0d3e707..47d1ee44a2 100644 --- a/src/or/dirauth/dirvote.c +++ b/src/or/dirauth/dirvote.c @@ -1756,9 +1756,9 @@ networkstatus_compute_consensus(smartlist_t *votes, /* Build the flag indexes. Note that no vote can have more than 64 members * for known_flags, so no value will be greater than 63, so it's safe to - * do U64_LITERAL(1) << index on these values. But note also that + * do UINT64_C(1) << index on these values. But note also that * named_flag and unnamed_flag are initialized to -1, so we need to check - * that they're actually set before doing U64_LITERAL(1) << index with + * that they're actually set before doing UINT64_C(1) << index with * them.*/ SMARTLIST_FOREACH_BEGIN(votes, networkstatus_t *, v) { flag_map[v_sl_idx] = tor_calloc(smartlist_len(v->known_flags), @@ -1787,7 +1787,7 @@ networkstatus_compute_consensus(smartlist_t *votes, uint64_t nf; if (named_flag[v_sl_idx]<0) continue; - nf = U64_LITERAL(1) << named_flag[v_sl_idx]; + nf = UINT64_C(1) << named_flag[v_sl_idx]; SMARTLIST_FOREACH_BEGIN(v->routerstatus_list, vote_routerstatus_t *, rs) { @@ -1812,7 +1812,7 @@ networkstatus_compute_consensus(smartlist_t *votes, uint64_t uf; if (unnamed_flag[v_sl_idx]<0) continue; - uf = U64_LITERAL(1) << unnamed_flag[v_sl_idx]; + uf = UINT64_C(1) << unnamed_flag[v_sl_idx]; SMARTLIST_FOREACH_BEGIN(v->routerstatus_list, vote_routerstatus_t *, rs) { if ((rs->flags & uf) != 0) { @@ -1902,11 +1902,11 @@ networkstatus_compute_consensus(smartlist_t *votes, /* Tally up all the flags. */ for (int flag = 0; flag < n_voter_flags[voter_idx]; ++flag) { - if (rs->flags & (U64_LITERAL(1) << flag)) + if (rs->flags & (UINT64_C(1) << flag)) ++flag_counts[flag_map[voter_idx][flag]]; } if (named_flag[voter_idx] >= 0 && - (rs->flags & (U64_LITERAL(1) << named_flag[voter_idx]))) { + (rs->flags & (UINT64_C(1) << named_flag[voter_idx]))) { if (chosen_name && strcmp(chosen_name, rs->status.nickname)) { log_notice(LD_DIR, "Conflict on naming for router: %s vs %s", chosen_name, rs->status.nickname); diff --git a/src/or/policies.c b/src/or/policies.c index 0f52d6bf15..ee1f3afe62 100644 --- a/src/or/policies.c +++ b/src/or/policies.c @@ -2408,7 +2408,7 @@ policy_summary_item_split(policy_summary_item_t* old, uint16_t new_starts) #define REJECT_CUTOFF_SCALE_IPV4 (0) /* Ports are rejected in an IPv4 summary if they are rejected in more than two * IPv4 /8 address blocks */ -#define REJECT_CUTOFF_COUNT_IPV4 (U64_LITERAL(1) << \ +#define REJECT_CUTOFF_COUNT_IPV4 (UINT64_C(1) << \ (IPV4_BITS - REJECT_CUTOFF_SCALE_IPV4 - 7)) #define IPV6_BITS (128) @@ -2420,7 +2420,7 @@ policy_summary_item_split(policy_summary_item_t* old, uint16_t new_starts) * some scattered smaller blocks) have been allocated to the RIRs. * Network providers are typically allocated one or more IPv6 /32s. */ -#define REJECT_CUTOFF_COUNT_IPV6 (U64_LITERAL(1) << \ +#define REJECT_CUTOFF_COUNT_IPV6 (UINT64_C(1) << \ (IPV6_BITS - REJECT_CUTOFF_SCALE_IPV6 - 16)) /** Split an exit policy summary so that prt_min and prt_max @@ -2515,7 +2515,7 @@ policy_summary_reject(smartlist_t *summary, * in the range. */ count = UINT64_MAX; } else { - count = (U64_LITERAL(1) << (addrbits - scale - maskbits)); + count = (UINT64_C(1) << (addrbits - scale - maskbits)); } tor_assert_nonfatal_once(count > 0); while (i < smartlist_len(summary) && diff --git a/src/or/routerparse.c b/src/or/routerparse.c index dfc298286b..9f3072bc32 100644 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@ -2724,7 +2724,7 @@ routerstatus_parse_entry_from_string(memarea_t *area, for (i=0; i < tok->n_args; ++i) { int p = smartlist_string_pos(vote->known_flags, tok->args[i]); if (p >= 0) { - vote_rs->flags |= (U64_LITERAL(1)<<p); + vote_rs->flags |= (UINT64_C(1)<<p); } else { log_warn(LD_DIR, "Flags line had a flag %s not listed in known_flags.", escaped(tok->args[i])); diff --git a/src/test/test_bwmgt.c b/src/test/test_bwmgt.c index 90c1b457d7..604987e070 100644 --- a/src/test/test_bwmgt.c +++ b/src/test/test_bwmgt.c @@ -16,7 +16,7 @@ // an imaginary time, in timestamp units. Chosen so it will roll over. static const uint32_t START_TS = UINT32_MAX-10; static const int32_t KB = 1024; -static const uint32_t GB = (U64_LITERAL(1) << 30); +static const uint32_t GB = (UINT64_C(1) << 30); static void test_bwmgt_token_buf_init(void *arg) diff --git a/src/test/test_channel.c b/src/test/test_channel.c index d236580fbd..53c133ecb0 100644 --- a/src/test/test_channel.c +++ b/src/test/test_channel.c @@ -554,7 +554,7 @@ test_channel_outbound_cell(void *arg) /* Set the test time to be mocked, since this test assumes that no * time will pass, ewma values will not need to be re-scaled, and so on */ monotime_enable_test_mocking(); - monotime_set_mock_time_nsec(U64_LITERAL(1000000000) * 12345); + monotime_set_mock_time_nsec(UINT64_C(1000000000) * 12345); cmux_ewma_set_options(NULL,NULL); diff --git a/src/test/test_circuitmux.c b/src/test/test_circuitmux.c index 8a89927df9..c2fd1ae68a 100644 --- a/src/test/test_circuitmux.c +++ b/src/test/test_circuitmux.c @@ -86,7 +86,7 @@ static void test_cmux_compute_ticks(void *arg) { const int64_t NS_PER_S = 1000 * 1000 * 1000; - const int64_t START_NS = U64_LITERAL(1217709000)*NS_PER_S; + const int64_t START_NS = UINT64_C(1217709000)*NS_PER_S; int64_t now; double rem; unsigned tick; diff --git a/src/test/test_config.c b/src/test/test_config.c index 1138989826..f33e547b89 100644 --- a/src/test/test_config.c +++ b/src/test/test_config.c @@ -5619,8 +5619,8 @@ test_config_include_opened_file_list(void *data) static void test_config_compute_max_mem_in_queues(void *data) { -#define GIGABYTE(x) (U64_LITERAL(x) << 30) -#define MEGABYTE(x) (U64_LITERAL(x) << 20) +#define GIGABYTE(x) (UINT64_C(x) << 30) +#define MEGABYTE(x) (UINT64_C(x) << 20) (void)data; MOCK(get_total_system_memory, get_total_system_memory_mock); diff --git a/src/test/test_crypto.c b/src/test/test_crypto.c index ecbc6745d7..c72c07dd14 100644 --- a/src/test/test_crypto.c +++ b/src/test/test_crypto.c @@ -195,10 +195,10 @@ test_crypto_rng(void *arg) j = crypto_rand_int(100); if (j < 0 || j >= 100) allok = 0; - big = crypto_rand_uint64(U64_LITERAL(1)<<40); - if (big >= (U64_LITERAL(1)<<40)) + big = crypto_rand_uint64(UINT64_C(1)<<40); + if (big >= (UINT64_C(1)<<40)) allok = 0; - big = crypto_rand_uint64(U64_LITERAL(5)); + big = crypto_rand_uint64(UINT64_C(5)); if (big >= 5) allok = 0; d = crypto_rand_double(); @@ -2806,8 +2806,8 @@ test_crypto_siphash(void *arg) { 0x72, 0x45, 0x06, 0xeb, 0x4c, 0x32, 0x8a, 0x95, } }; - const struct sipkey K = { U64_LITERAL(0x0706050403020100), - U64_LITERAL(0x0f0e0d0c0b0a0908) }; + const struct sipkey K = { UINT64_C(0x0706050403020100), + UINT64_C(0x0f0e0d0c0b0a0908) }; uint8_t input[64]; int i, j; diff --git a/src/test/test_dir.c b/src/test/test_dir.c index 498ecf942e..70a8bc50ef 100644 --- a/src/test/test_dir.c +++ b/src/test/test_dir.c @@ -2102,7 +2102,7 @@ test_vrs_for_v3ns(vote_routerstatus_t *vrs, int voter, time_t now) tt_int_op(rs->or_port,OP_EQ, 443); tt_int_op(rs->dir_port,OP_EQ, 8000); /* no flags except "running" (16) and "v2dir" (64) and "valid" (128) */ - tt_u64_op(vrs->flags, OP_EQ, U64_LITERAL(0xd0)); + tt_u64_op(vrs->flags, OP_EQ, UINT64_C(0xd0)); } else if (tor_memeq(rs->identity_digest, "\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5" "\x5\x5\x5\x5", @@ -2128,10 +2128,10 @@ test_vrs_for_v3ns(vote_routerstatus_t *vrs, int voter, time_t now) tt_int_op(rs->ipv6_orport,OP_EQ, 4711); if (voter == 1) { /* all except "authority" (1) */ - tt_u64_op(vrs->flags, OP_EQ, U64_LITERAL(254)); + tt_u64_op(vrs->flags, OP_EQ, UINT64_C(254)); } else { /* 1023 - authority(1) - madeofcheese(16) - madeoftin(32) */ - tt_u64_op(vrs->flags, OP_EQ, U64_LITERAL(974)); + tt_u64_op(vrs->flags, OP_EQ, UINT64_C(974)); } } else if (tor_memeq(rs->identity_digest, "\x33\x33\x33\x33\x33\x33\x33\x33\x33\x33" @@ -2941,8 +2941,8 @@ test_dir_scale_bw(void *testdata) for (i=0; i<8; ++i) { total += vals_u64[i]; } - tt_assert(total >= (U64_LITERAL(1)<<60)); - tt_assert(total <= (U64_LITERAL(1)<<62)); + tt_assert(total >= (UINT64_C(1)<<60)); + tt_assert(total <= (UINT64_C(1)<<62)); for (i=0; i<8; ++i) { /* vals[2].u64 is the scaled value of 1.0 */ diff --git a/src/test/test_mainloop.c b/src/test/test_mainloop.c index 559bbe587a..469820b591 100644 --- a/src/test/test_mainloop.c +++ b/src/test/test_mainloop.c @@ -21,7 +21,7 @@ test_mainloop_update_time_normal(void *arg) monotime_enable_test_mocking(); /* This is arbitrary */ - uint64_t mt_now = U64_LITERAL(7493289274986); + uint64_t mt_now = UINT64_C(7493289274986); /* This time is in the past as of when this test was written. */ time_t now = 1525272090; monotime_coarse_set_mock_time_nsec(mt_now); @@ -63,7 +63,7 @@ test_mainloop_update_time_jumps(void *arg) monotime_enable_test_mocking(); /* This is arbitrary */ - uint64_t mt_now = U64_LITERAL(7493289274986); + uint64_t mt_now = UINT64_C(7493289274986); /* This time is in the past as of when this test was written. */ time_t now = 220897152; monotime_coarse_set_mock_time_nsec(mt_now); diff --git a/src/test/test_options.c b/src/test/test_options.c index ab8727c3db..ec574c548e 100644 --- a/src/test/test_options.c +++ b/src/test/test_options.c @@ -275,7 +275,7 @@ test_options_validate(void *arg) return; } -#define MEGABYTEIFY(mb) (U64_LITERAL(mb) << 20) +#define MEGABYTEIFY(mb) (UINT64_C(mb) << 20) static void test_have_enough_mem_for_dircache(void *arg) { diff --git a/src/test/test_status.c b/src/test/test_status.c index 09b9662b4c..25577cdafa 100644 --- a/src/test/test_status.c +++ b/src/test/test_status.c @@ -230,7 +230,7 @@ NS(test_main)(void *arg) tor_free(actual); expected = "10.00 GB"; - actual = bytes_to_usage((U64_LITERAL(1) << 30) * 10L); + actual = bytes_to_usage((UINT64_C(1) << 30) * 10L); tt_str_op(actual, OP_EQ, expected); tor_free(actual); diff --git a/src/test/test_util.c b/src/test/test_util.c index 53d329210d..5fea1a463d 100644 --- a/src/test/test_util.c +++ b/src/test/test_util.c @@ -1919,7 +1919,7 @@ test_util_strmisc(void *arg) tt_int_op(0,OP_EQ, buf[6]); /* uint64 */ tor_snprintf(buf, sizeof(buf), "x!"U64_FORMAT"!x", - U64_PRINTF_ARG(U64_LITERAL(12345678901))); + U64_PRINTF_ARG(UINT64_C(12345678901))); tt_str_op("x!12345678901!x",OP_EQ, buf); /* Test str{,case}cmpstart */ @@ -2166,17 +2166,17 @@ test_util_parse_integer(void *arg) tt_int_op(0,OP_EQ, i); /* Test parse_uint64 */ - tt_assert(U64_LITERAL(10) == tor_parse_uint64("10 x",10,0,100, &i, &cp)); + tt_assert(UINT64_C(10) == tor_parse_uint64("10 x",10,0,100, &i, &cp)); tt_int_op(1,OP_EQ, i); tt_str_op(cp,OP_EQ, " x"); - tt_assert(U64_LITERAL(12345678901) == + tt_assert(UINT64_C(12345678901) == tor_parse_uint64("12345678901",10,0,UINT64_MAX, &i, &cp)); tt_int_op(1,OP_EQ, i); tt_str_op(cp,OP_EQ, ""); - tt_assert(U64_LITERAL(0) == + tt_assert(UINT64_C(0) == tor_parse_uint64("12345678901",10,500,INT32_MAX, &i, &cp)); tt_int_op(0,OP_EQ, i); - tt_assert(U64_LITERAL(0) == + tt_assert(UINT64_C(0) == tor_parse_uint64("123",-1,0,INT32_MAX, &i, &cp)); tt_int_op(0,OP_EQ, i); @@ -2217,7 +2217,7 @@ test_util_parse_integer(void *arg) tt_int_op(i,OP_EQ, 0); tt_int_op(0UL,OP_EQ, tor_parse_ulong(TOOBIG, 10, 0, ULONG_MAX, &i, NULL)); tt_int_op(i,OP_EQ, 0); - tt_u64_op(U64_LITERAL(0), OP_EQ, tor_parse_uint64(TOOBIG, 10, + tt_u64_op(UINT64_C(0), OP_EQ, tor_parse_uint64(TOOBIG, 10, 0, UINT64_MAX, &i, NULL)); tt_int_op(i,OP_EQ, 0); } @@ -2240,17 +2240,17 @@ test_util_pow2(void *arg) tt_int_op(tor_log2(3),OP_EQ, 1); tt_int_op(tor_log2(4),OP_EQ, 2); tt_int_op(tor_log2(5),OP_EQ, 2); - tt_int_op(tor_log2(U64_LITERAL(40000000000000000)),OP_EQ, 55); + tt_int_op(tor_log2(UINT64_C(40000000000000000)),OP_EQ, 55); tt_int_op(tor_log2(UINT64_MAX),OP_EQ, 63); /* Test round_to_power_of_2 */ tt_u64_op(round_to_power_of_2(120), OP_EQ, 128); tt_u64_op(round_to_power_of_2(128), OP_EQ, 128); tt_u64_op(round_to_power_of_2(130), OP_EQ, 128); - tt_u64_op(round_to_power_of_2(U64_LITERAL(40000000000000000)), OP_EQ, - U64_LITERAL(1)<<55); - tt_u64_op(round_to_power_of_2(U64_LITERAL(0xffffffffffffffff)), OP_EQ, - U64_LITERAL(1)<<63); + tt_u64_op(round_to_power_of_2(UINT64_C(40000000000000000)), OP_EQ, + UINT64_C(1)<<55); + tt_u64_op(round_to_power_of_2(UINT64_C(0xffffffffffffffff)), OP_EQ, + UINT64_C(1)<<63); tt_u64_op(round_to_power_of_2(0), OP_EQ, 1); tt_u64_op(round_to_power_of_2(1), OP_EQ, 1); tt_u64_op(round_to_power_of_2(2), OP_EQ, 2); @@ -5565,7 +5565,7 @@ test_util_max_mem(void *arg) } else { /* You do not have a petabyte. */ #if SIZEOF_SIZE_T >= 8 - tt_u64_op(memory1, OP_LT, (U64_LITERAL(1)<<50)); + tt_u64_op(memory1, OP_LT, (UINT64_C(1)<<50)); #endif } diff --git a/src/test/test_util_format.c b/src/test/test_util_format.c index 44a00b9b77..ea42d8dd5a 100644 --- a/src/test/test_util_format.c +++ b/src/test/test_util_format.c @@ -19,7 +19,7 @@ test_util_format_unaligned_accessors(void *ignored) char buf[9] = "onionsoup"; // 6f6e696f6e736f7570 tt_u64_op(get_uint64(buf+1), OP_EQ, - tor_htonll(U64_LITERAL(0x6e696f6e736f7570))); + tor_htonll(UINT64_C(0x6e696f6e736f7570))); tt_uint_op(get_uint32(buf+1), OP_EQ, htonl(0x6e696f6e)); tt_uint_op(get_uint16(buf+1), OP_EQ, htons(0x6e69)); tt_uint_op(get_uint8(buf+1), OP_EQ, 0x6e); @@ -33,7 +33,7 @@ test_util_format_unaligned_accessors(void *ignored) set_uint32(buf+1, htonl(0x78696465)); tt_mem_op(buf, OP_EQ, "oxidestop", 9); - set_uint64(buf+1, tor_htonll(U64_LITERAL(0x6266757363617465))); + set_uint64(buf+1, tor_htonll(UINT64_C(0x6266757363617465))); tt_mem_op(buf, OP_EQ, "obfuscate", 9); done: ; |