From c3c3332a039e8e9cc10f93c3acb71c4240d4cab8 Mon Sep 17 00:00:00 2001 From: Andrea Mattavelli Date: Mon, 13 Feb 2017 14:38:08 +0000 Subject: Refactoring code to improve readability by using UINT32/64_C macros --- include/klee/util/Bits.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/klee/util/Bits.h b/include/klee/util/Bits.h index 7d1797f5..d56c7c21 100644 --- a/include/klee/util/Bits.h +++ b/include/klee/util/Bits.h @@ -22,13 +22,13 @@ namespace klee { assert(N <= 32); if (N==0) return 0; - return ((unsigned) -1) >> (32 - N); + return (UINT32_C(-1)) >> (32 - N); } // @pre(0 < N <= 32) inline unsigned truncateToNBits(unsigned x, unsigned N) { assert(N > 0 && N <= 32); - return x&(((unsigned) -1) >> (32 - N)); + return x&((UINT32_C(-1)) >> (32 - N)); } inline unsigned withoutRightmostBit(unsigned x) { @@ -71,13 +71,13 @@ namespace klee { assert(N <= 64); if (N==0) return 0; - return ((uint64_t) (int64_t) -1) >> (64 - N); + return ((UINT64_C(-1)) >> (64 - N)); } // @pre(0 < N <= 64) inline uint64_t truncateToNBits(uint64_t x, unsigned N) { assert(N > 0 && N <= 64); - return x&(((uint64_t) (int64_t) -1) >> (64 - N)); + return x&((UINT64_C(-1)) >> (64 - N)); } inline uint64_t withoutRightmostBit(uint64_t x) { @@ -98,7 +98,7 @@ namespace klee { inline unsigned indexOfSingleBit(uint64_t x) { assert((x & (x - 1)) == 0); unsigned res = bits32::indexOfSingleBit((unsigned) (x | (x>>32))); - if (x & ((uint64_t)0xFFFFFFFF << 32)) + if (x & (UINT64_C(0xFFFFFFFF) << 32)) res += 32; assert(res < 64); assert((UINT64_C(1) << res) == x); -- cgit 1.4.1