Skip to content

Commit

Permalink
Replace toU64 to ByteToU64
Browse files Browse the repository at this point in the history
  • Loading branch information
ImTei committed Jan 16, 2025
1 parent 1fd0120 commit 429e8cd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion rvgo/fast/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ func (inst *InstrumentedState) riscvStep() (outErr error) {
if and64(imm, byteToU64(0x20)) != 0 {
revertWithCode(riscv.ErrInvalidSyscall, fmt.Errorf("illegal instruction %d: reserved instruction encoding", instr))
}
rdValue = mask32Signed64(shl64(and64(imm, toU64(0x1F)), rs1Value))
rdValue = mask32Signed64(shl64(and64(imm, byteToU64(0x1F)), rs1Value))
case 5: // 101 = SR~
// SRLIW and SRAIW where imm[5] != 0 is reserved
if and64(imm, byteToU64(0x20)) != 0 {
Expand Down
4 changes: 2 additions & 2 deletions rvgo/slow/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ func Step(calldata []byte, po PreimageOracle) (stateHash common.Hash, outErr err
}

// The PC must be aligned to 4 bytes.
if and64(pc, toU64(3)) != (U64{}) {
if and64(pc, byteToU64(3)) != (U64{}) {
revertWithCode(riscv.ErrNotAlignedAddr, fmt.Errorf("pc %d not aligned with 4 bytes", pc))
}

Expand Down Expand Up @@ -870,7 +870,7 @@ func Step(calldata []byte, po PreimageOracle) (stateHash common.Hash, outErr err
if and64(imm, byteToU64(0x20)) != (U64{}) {
revertWithCode(riscv.ErrInvalidSyscall, fmt.Errorf("illegal instruction %d: reserved instruction encoding", instr))
}
rdValue = mask32Signed64(shl64(and64(imm, toU64(0x1F)), rs1Value))
rdValue = mask32Signed64(shl64(and64(imm, byteToU64(0x1F)), rs1Value))
case 5: // 101 = SR~
// SRLIW and SRAIW imm[5] != 0 is reserved
if and64(imm, byteToU64(0x20)) != (U64{}) {
Expand Down

0 comments on commit 429e8cd

Please sign in to comment.