Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mu-impl-ref2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
5
Issues
5
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mu
mu-impl-ref2
Commits
286db316
Commit
286db316
authored
May 22, 2017
by
John Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: construct BigInt with lower bit first
parent
39bb004b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
7 deletions
+11
-7
IRBuilderCommInstExecutor.scala
...in/scala/uvm/refimpl/itpr/IRBuilderCommInstExecutor.scala
+3
-1
NativeMemoryAccessHelper.scala
...main/scala/uvm/refimpl/nat/NativeMemoryAccessHelper.scala
+8
-6
No files found.
src/main/scala/uvm/refimpl/itpr/IRBuilderCommInstExecutor.scala
View file @
286db316
...
...
@@ -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
)
&
0xffffffffffffffff
L
)
bigNum
=
bigNum
|
((
BigInt
(
num
)
&
0xffffffffffffffff
L
)
<<
64
*
i
)
i
+=
1
}
bigNum
}
...
...
src/main/scala/uvm/refimpl/nat/NativeMemoryAccessHelper.scala
View file @
286db316
...
...
@@ -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
)
&
0xffffffffffffffff
L
)
}
bigNum
var
bigNum
=
BigInt
(
0
)
var
i
=
0
for
(
num
<-
nums
)
{
bigNum
=
bigNum
|
((
BigInt
(
num
)
&
0xffffffffffffffff
L
)
<<
64
*
i
)
i
+=
1
}
bigNum
}
def
readIntArray
(
base
:
Long
,
len
:
Long
)
:
IndexedSeq
[
Int
]
=
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment