mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-27 13:40:30 +00:00
[MC] Check the upper bound in truncate assertion
The truncateToSize function already has assertion to check the lower boundary for the number bytes, but it does not check the upper boundary which could still lead to usage errors. Differential Revision: http://reviews.llvm.org/D20755 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271773 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2c2ab512e8
commit
28a52a5d69
@ -314,7 +314,7 @@ void MCAsmStreamer::EmitCommentsAndEOL() {
|
||||
}
|
||||
|
||||
static inline int64_t truncateToSize(int64_t Value, unsigned Bytes) {
|
||||
assert(Bytes && "Invalid size!");
|
||||
assert(Bytes > 0 && Bytes <= 8 && "Invalid size!");
|
||||
return Value & ((uint64_t) (int64_t) -1 >> (64 - Bytes * 8));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user