Dipanjan Das via llvm-dev
2017-Oct-20 00:26 UTC
[llvm-dev] How to create a 64 bit ConstInt having a value of -1?
I tried the following: - ConstantInt::get(Type::getInt64Ty(Ctx), APInt(0xFFFFFFFFFFFFFFFF, 64, false)) - ConstantInt::get(Type::getInt64Ty(Ctx), APInt(-1, 64)) I am receiving the following error: Assertion `NumBits <= MAX_INT_BITS && "bitwidth too large" failed -- Thanks & Regards, Dipanjan -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171019/2e76a814/attachment.html>
Craig Topper via llvm-dev
2017-Oct-20 01:35 UTC
[llvm-dev] How to create a 64 bit ConstInt having a value of -1?
Your APInt constructor arguments are reversed. Bit width comes first. The value. On Thu, Oct 19, 2017 at 5:27 PM Dipanjan Das via llvm-dev < llvm-dev at lists.llvm.org> wrote:> > I tried the following: > > - ConstantInt::get(Type::getInt64Ty(Ctx), APInt(0xFFFFFFFFFFFFFFFF, 64, > false)) > - ConstantInt::get(Type::getInt64Ty(Ctx), APInt(-1, 64)) > > I am receiving the following error: Assertion `NumBits <= MAX_INT_BITS && > "bitwidth too large" failed > > -- > > Thanks & Regards, > Dipanjan > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-- ~Craig -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171020/b484c639/attachment.html>
Dipanjan Das via llvm-dev
2017-Oct-20 04:16 UTC
[llvm-dev] How to create a 64 bit ConstInt having a value of -1?
Thanks Craig. Too dumb of me. On 19 October 2017 at 18:35, Craig Topper <craig.topper at gmail.com> wrote:> Your APInt constructor arguments are reversed. Bit width comes first. The > value. > > On Thu, Oct 19, 2017 at 5:27 PM Dipanjan Das via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > >> >> I tried the following: >> >> - ConstantInt::get(Type::getInt64Ty(Ctx), APInt(0xFFFFFFFFFFFFFFFF, 64, >> false)) >> - ConstantInt::get(Type::getInt64Ty(Ctx), APInt(-1, 64)) >> >> I am receiving the following error: Assertion `NumBits <= MAX_INT_BITS && >> "bitwidth too large" failed >> >> -- >> >> Thanks & Regards, >> Dipanjan >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >> > -- > ~Craig >-- Thanks & Regards, Dipanjan -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171019/89ec81b6/attachment.html>