diff options
author | Andrea Mattavelli <andreamattavelli@gmail.com> | 2017-02-13 14:38:08 +0000 |
---|---|---|
committer | Dan Liew <delcypher@gmail.com> | 2017-02-14 13:47:59 +0000 |
commit | c3c3332a039e8e9cc10f93c3acb71c4240d4cab8 (patch) | |
tree | eb96442a54a5db97d138a8caf2b6c531357ad068 /include | |
parent | a787fc2aee9ced9478bc2a1bdd5336f6aa38b8bb (diff) | |
download | klee-c3c3332a039e8e9cc10f93c3acb71c4240d4cab8.tar.gz |
Refactoring code to improve readability by using UINT32/64_C macros
Diffstat (limited to 'include')
-rw-r--r-- | include/klee/util/Bits.h | 10 |
1 files changed, 5 insertions, 5 deletions
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); |