Chromium Code Reviews| 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 |
| 11 /// \brief This file implements a class to represent 64 bit integer constant | 11 /// \brief This file implements a class to represent 64 bit integer constant |
| 12 /// values, and thier conversion to variable bit sized integers. | 12 /// values, and thier conversion to variable bit sized integers. |
|
JF
2015/02/24 16:57:05
typo
Jim Stichnoth
2015/02/24 17:27:10
Done.
| |
| 13 /// | 13 /// |
| 14 /// Note: This is a simplified version of llvm/include/llvm/ADT/APInt.h for use | 14 /// Note: This is a simplified version of llvm/include/llvm/ADT/APInt.h for use |
| 15 /// with Subzero. | 15 /// with Subzero. |
| 16 //===----------------------------------------------------------------------===// | 16 //===----------------------------------------------------------------------===// |
| 17 | 17 |
| 18 #ifndef SUBZERO_SRC_ICEAPINT_H | 18 #ifndef SUBZERO_SRC_ICEAPINT_H |
| 19 #define SUBZERO_SRC_ICEAPINT_H | 19 #define SUBZERO_SRC_ICEAPINT_H |
| 20 | 20 |
| 21 #include "IceDefs.h" | 21 #include "IceDefs.h" |
| 22 | 22 |
| 23 namespace Ice { | 23 namespace Ice { |
| 24 | 24 |
| 25 class APInt { | 25 class APInt { |
| 26 APInt() = delete; | |
| 27 APInt(const APInt &) = delete; | |
| 28 APInt &operator=(const APInt &) = delete; | |
| 29 | |
| 26 public: | 30 public: |
| 27 /// Bits in an (internal) value. | 31 /// Bits in an (internal) value. |
| 28 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; |
| 29 | 33 |
| 30 APInt(SizeT Bits, uint64_t Val) : BitWidth(Bits), Val(Val) { | 34 APInt(SizeT Bits, uint64_t Val) : BitWidth(Bits), Val(Val) { |
| 31 assert(Bits && "bitwidth too small"); | 35 assert(Bits && "bitwidth too small"); |
| 32 assert(Bits <= APINT_BITS_PER_WORD && "bitwidth too big"); | 36 assert(Bits <= APINT_BITS_PER_WORD && "bitwidth too big"); |
| 33 clearUnusedBits(); | 37 clearUnusedBits(); |
| 34 } | 38 } |
| 35 | 39 |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 53 return; | 57 return; |
| 54 | 58 |
| 55 // Mask out the high bits. | 59 // Mask out the high bits. |
| 56 Val &= ~static_cast<uint64_t>(0) >> (APINT_BITS_PER_WORD - BitWidth); | 60 Val &= ~static_cast<uint64_t>(0) >> (APINT_BITS_PER_WORD - BitWidth); |
| 57 } | 61 } |
| 58 }; | 62 }; |
| 59 | 63 |
| 60 } // end of namespace Ice | 64 } // end of namespace Ice |
| 61 | 65 |
| 62 #endif // SUBZERO_SRC_ICEAPINT_H | 66 #endif // SUBZERO_SRC_ICEAPINT_H |
| OLD | NEW |