Skip to content

Commit 16d3907

Browse files
ilyidacnheitman
authored andcommitted
Bug fix for 128-bit integer support with LLVM
1 parent b9adc4a commit 16d3907

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/libtriton/ast/llvm/tritonToLLVM.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,11 @@ namespace triton {
267267
if (bitSize <= triton::bitsize::qword) {
268268
return llvm::ConstantInt::get(this->llvmContext, llvm::APInt(bitSize, static_cast<uint64_t>(value), false));
269269
}
270-
else if (bitSize == triton::bitsize::dqword) {
271-
uint64_t low = static_cast<uint64_t>(value);
272-
uint64_t high = static_cast<uint64_t>(value >> 64);
273-
std::array<uint64_t, 2> arr64 = { low, high };
270+
else if (bitSize <= triton::bitsize::dqqword) {
271+
std::array<uint64_t, 8> arr64;
272+
for (uint64_t i = 0; i < bitSize / 64; i++) {
273+
arr64[i] = static_cast<uint64_t>(value >> (i * 64));
274+
}
274275
return llvm::ConstantInt::get(this->llvmContext, llvm::APInt(bitSize, arr64));
275276
}
276277
else {

0 commit comments

Comments
 (0)