Skip to content

Commit

Permalink
Implement positive64BitIntegerFor
Browse files Browse the repository at this point in the history
  • Loading branch information
DieKautz committed Feb 9, 2024
1 parent 9eaa707 commit fac45ec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ VirtualMachine* createInterpreterProxy(
sqInt (*popthenPush)(sqInt nItems, sqInt oop),
sqInt (*positive32BitIntegerFor)(unsigned int integerValue),
usqInt (*positive32BitValueOf)(sqInt oop),
sqInt (*positive64BitIntegerFor)(usqLong integerValue),
usqLong (*positive64BitValueOf)(sqInt oop),
sqInt (*primitiveFail)(void),
sqInt (*primitiveFailFor)(sqInt reasonCode),
Expand Down Expand Up @@ -147,6 +148,7 @@ VirtualMachine* createInterpreterProxy(
interpreterProxy->popthenPush = popthenPush;
interpreterProxy->positive32BitIntegerFor = positive32BitIntegerFor;
interpreterProxy->positive32BitValueOf = positive32BitValueOf;
interpreterProxy->positive64BitIntegerFor = positive64BitIntegerFor;
interpreterProxy->positive64BitValueOf = positive64BitValueOf;
interpreterProxy->primitiveFail = primitiveFail;
interpreterProxy->primitiveFailFor = primitiveFailFor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ private TruffleExecutable[] getExecutables() {
TruffleExecutable.wrap("(SINT64,SINT64):SINT64", this::popthenPush),
TruffleExecutable.wrap("(UINT64):SINT64", this::positive32BitIntegerFor),
TruffleExecutable.wrap("(SINT64):UINT64", this::positive32BitValueOf),
TruffleExecutable.wrap("(SINT64):UINT64", this::positive64BitIntegerFor),
TruffleExecutable.wrap("(SINT64):UINT64", this::positive64BitValueOf),
TruffleExecutable.wrap("():SINT64", this::primitiveFail),
TruffleExecutable.wrap("(SINT64):SINT64", this::primitiveFailFor),
Expand Down Expand Up @@ -651,6 +652,10 @@ private long positive32BitValueOf(final long oop) {
return integerValueOf(oop) & Integer.MAX_VALUE;
}

private long positive64BitIntegerFor(final long integerValue) {
return integerObjectOf(Math.abs(integerValue));
}

private long positive64BitValueOf(final long oop) {
return Math.abs(integerValueOf(oop));
}
Expand Down

0 comments on commit fac45ec

Please sign in to comment.