Commit 286db316 authored by John Zhang's avatar John Zhang

fix: construct BigInt with lower bit first

parent 39bb004b
......@@ -24,8 +24,10 @@ object IRBuilderCommInstExecutor {
def unsignedLongSeqToBigInt(nums: Seq[Long]): BigInt = {
var bigNum = BigInt(0)
var i = 0
for (num <- nums) {
bigNum = (bigNum << 64) | (BigInt(num) & 0xffffffffffffffffL)
bigNum = bigNum | ((BigInt(num) & 0xffffffffffffffffL) << 64 * i)
i += 1
}
bigNum
}
......
......@@ -22,13 +22,15 @@ object NativeMemoryAccessHelper {
val str = theMemory.getString(base, len.toInt, StandardCharsets.US_ASCII)
str
}
def unsignedLongSeqToBigInt(nums: Seq[Long]): BigInt = {
var bigNum = BigInt(0)
for (num <- nums) {
bigNum = (bigNum << 64) | (BigInt(num) & 0xffffffffffffffffL)
}
bigNum
var bigNum = BigInt(0)
var i = 0
for (num <- nums) {
bigNum = bigNum | ((BigInt(num) & 0xffffffffffffffffL) << 64 * i)
i += 1
}
bigNum
}
def readIntArray(base: Long, len: Long): IndexedSeq[Int] = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment