Make getNumWords public so that those using getRawData stand a chance of
not reading beyond the end of the buffer returned. llvm-svn: 34873
This commit is contained in:
parent
22c4fedabf
commit
1a7d446963
|
@ -79,13 +79,6 @@ class APInt {
|
||||||
// Fast internal constructor
|
// Fast internal constructor
|
||||||
APInt(uint64_t* val, uint32_t bits) : BitWidth(bits), pVal(val) { }
|
APInt(uint64_t* val, uint32_t bits) : BitWidth(bits), pVal(val) { }
|
||||||
|
|
||||||
/// Here one word's bitwidth equals to that of uint64_t.
|
|
||||||
/// @returns the number of words to hold the integer value of this APInt.
|
|
||||||
/// @brief Get the number of words.
|
|
||||||
inline uint32_t getNumWords() const {
|
|
||||||
return (BitWidth + APINT_BITS_PER_WORD - 1) / APINT_BITS_PER_WORD;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @returns true if the number of bits <= 64, false otherwise.
|
/// @returns true if the number of bits <= 64, false otherwise.
|
||||||
/// @brief Determine if this APInt just has one word to store value.
|
/// @brief Determine if this APInt just has one word to store value.
|
||||||
inline bool isSingleWord() const {
|
inline bool isSingleWord() const {
|
||||||
|
@ -486,6 +479,13 @@ public:
|
||||||
return whichWord(getActiveBits()-1) + 1;
|
return whichWord(getActiveBits()-1) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Here one word's bitwidth equals to that of uint64_t.
|
||||||
|
/// @returns the number of words to hold the integer value of this APInt.
|
||||||
|
/// @brief Get the number of words.
|
||||||
|
inline uint32_t getNumWords() const {
|
||||||
|
return (BitWidth + APINT_BITS_PER_WORD - 1) / APINT_BITS_PER_WORD;
|
||||||
|
}
|
||||||
|
|
||||||
/// This function returns a pointer to the internal storage of the APInt.
|
/// This function returns a pointer to the internal storage of the APInt.
|
||||||
/// This is useful for writing out the APInt in binary form without any
|
/// This is useful for writing out the APInt in binary form without any
|
||||||
/// conversions.
|
/// conversions.
|
||||||
|
|
Loading…
Reference in New Issue