[ADT] Make Load(AP)IntFromMemory pointer argument const

The function does not modify this memory.
This commit is contained in:
Pavel Labath 2020-07-13 17:15:25 +02:00
parent 7ff41afc34
commit af4f8a5640
2 changed files with 3 additions and 2 deletions

View File

@ -2286,7 +2286,7 @@ void StoreIntToMemory(const APInt &IntVal, uint8_t *Dst, unsigned StoreBytes);
/// LoadIntFromMemory - Loads the integer stored in the LoadBytes bytes starting
/// from Src into IntVal, which is assumed to be wide enough and to hold zero.
void LoadIntFromMemory(APInt &IntVal, uint8_t *Src, unsigned LoadBytes);
void LoadIntFromMemory(APInt &IntVal, const uint8_t *Src, unsigned LoadBytes);
} // namespace llvm

View File

@ -3086,7 +3086,8 @@ void llvm::StoreIntToMemory(const APInt &IntVal, uint8_t *Dst,
/// LoadIntFromMemory - Loads the integer stored in the LoadBytes bytes starting
/// from Src into IntVal, which is assumed to be wide enough and to hold zero.
void llvm::LoadIntFromMemory(APInt &IntVal, uint8_t *Src, unsigned LoadBytes) {
void llvm::LoadIntFromMemory(APInt &IntVal, const uint8_t *Src,
unsigned LoadBytes) {
assert((IntVal.getBitWidth()+7)/8 >= LoadBytes && "Integer too small!");
uint8_t *Dst = reinterpret_cast<uint8_t *>(
const_cast<uint64_t *>(IntVal.getRawData()));