diff options
| author | Reid Spencer <rspencer@reidspencer.com> | 2007-02-05 23:47:56 +0000 |
|---|---|---|
| committer | Reid Spencer <rspencer@reidspencer.com> | 2007-02-05 23:47:56 +0000 |
| commit | d7a00d741402208e4abb99c79a9c64f597f89715 (patch) | |
| tree | 7425a68663984199a165c47ff53b6a033ed585e1 /llvm/lib | |
| parent | f75727ab146880ade52df250150bbcc638fd1da0 (diff) | |
| download | bcm5719-llvm-d7a00d741402208e4abb99c79a9c64f597f89715.tar.gz bcm5719-llvm-d7a00d741402208e4abb99c79a9c64f597f89715.zip | |
A value of 64 or fewer bits is valid if the ConstantInt has more then 64 bits.
llvm-svn: 33942
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/VMCore/Constants.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/llvm/lib/VMCore/Constants.cpp b/llvm/lib/VMCore/Constants.cpp index 8a6e11de3ab..51344955f6d 100644 --- a/llvm/lib/VMCore/Constants.cpp +++ b/llvm/lib/VMCore/Constants.cpp @@ -554,10 +554,9 @@ getWithOperands(const std::vector<Constant*> &Ops) const { bool ConstantInt::isValueValidForType(const Type *Ty, uint64_t Val) { unsigned NumBits = cast<IntegerType>(Ty)->getBitWidth(); // assert okay - assert(NumBits <= 64 && "Not implemented: integers > 64-bits"); if (Ty == Type::Int1Ty) return Val == 0 || Val == 1; - if (NumBits == 64) + if (NumBits >= 64) return true; // always true, has to fit in largest type uint64_t Max = (1ll << NumBits) - 1; return Val <= Max; @@ -565,10 +564,9 @@ bool ConstantInt::isValueValidForType(const Type *Ty, uint64_t Val) { bool ConstantInt::isValueValidForType(const Type *Ty, int64_t Val) { unsigned NumBits = cast<IntegerType>(Ty)->getBitWidth(); // assert okay - assert(NumBits <= 64 && "Not implemented: integers > 64-bits"); if (Ty == Type::Int1Ty) return Val == 0 || Val == 1 || Val == -1; - if (NumBits == 64) + if (NumBits >= 64) return true; // always true, has to fit in largest type int64_t Min = -(1ll << (NumBits-1)); int64_t Max = (1ll << (NumBits-1)) - 1; |

