| OLD | NEW |
| 1 //===-- subzero/src/IceAPInt.h - Constant integer conversions --*- C++ -*--===// | 1 //===-- subzero/src/IceAPInt.h - Constant integer conversions --*- C++ -*--===// |
| 2 // | 2 // |
| 3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 /// | 9 /// |
| 10 /// \file | 10 /// \file |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 class APInt { | 25 class APInt { |
| 26 APInt() = delete; | 26 APInt() = delete; |
| 27 APInt(const APInt &) = delete; | 27 APInt(const APInt &) = delete; |
| 28 APInt &operator=(const APInt &) = delete; | 28 APInt &operator=(const APInt &) = delete; |
| 29 | 29 |
| 30 public: | 30 public: |
| 31 /// Bits in an (internal) value. | 31 /// Bits in an (internal) value. |
| 32 static const SizeT APINT_BITS_PER_WORD = sizeof(uint64_t) * CHAR_BIT; | 32 static const SizeT APINT_BITS_PER_WORD = sizeof(uint64_t) * CHAR_BIT; |
| 33 | 33 |
| 34 APInt(SizeT Bits, uint64_t Val) : BitWidth(Bits), Val(Val) { | 34 APInt(SizeT Bits, uint64_t MyVal) : BitWidth(Bits), Val(MyVal) { |
| 35 assert(Bits && "bitwidth too small"); | 35 assert(Bits && "bitwidth too small"); |
| 36 assert(Bits <= APINT_BITS_PER_WORD && "bitwidth too big"); | 36 assert(Bits <= APINT_BITS_PER_WORD && "bitwidth too big"); |
| 37 clearUnusedBits(); | 37 clearUnusedBits(); |
| 38 } | 38 } |
| 39 | 39 |
| 40 uint32_t getBitWidth() const { return BitWidth; } | 40 uint32_t getBitWidth() const { return BitWidth; } |
| 41 | 41 |
| 42 int64_t getSExtValue() const { | 42 int64_t getSExtValue() const { |
| 43 return static_cast<int64_t>(Val << (APINT_BITS_PER_WORD - BitWidth)) >> | 43 return static_cast<int64_t>(Val << (APINT_BITS_PER_WORD - BitWidth)) >> |
| 44 (APINT_BITS_PER_WORD - BitWidth); | 44 (APINT_BITS_PER_WORD - BitWidth); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 57 return; | 57 return; |
| 58 | 58 |
| 59 // Mask out the high bits. | 59 // Mask out the high bits. |
| 60 Val &= ~static_cast<uint64_t>(0) >> (APINT_BITS_PER_WORD - BitWidth); | 60 Val &= ~static_cast<uint64_t>(0) >> (APINT_BITS_PER_WORD - BitWidth); |
| 61 } | 61 } |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 } // end of namespace Ice | 64 } // end of namespace Ice |
| 65 | 65 |
| 66 #endif // SUBZERO_SRC_ICEAPINT_H | 66 #endif // SUBZERO_SRC_ICEAPINT_H |
| OLD | NEW |