summaryrefslogtreecommitdiff
path: root/src/lib/intmath
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-07-03 10:33:50 -0400
committerNick Mathewson <nickm@torproject.org>2018-07-03 10:33:50 -0400
commit52884f56d43670f1960d9354ccc3ace9a048e283 (patch)
tree298e3f789a003cc9f08e4f8e24bf93964711b60c /src/lib/intmath
parentcf0b07c2e5284325fb89f2c8ee3ad99f5ed02195 (diff)
downloadtor-52884f56d43670f1960d9354ccc3ace9a048e283.tar.gz
tor-52884f56d43670f1960d9354ccc3ace9a048e283.zip
Replace U64_LITERAL with the standard UINT64_C
Diffstat (limited to 'src/lib/intmath')
-rw-r--r--src/lib/intmath/bits.c16
1 files changed, 8 insertions, 8 deletions
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