Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
DQNEO committed Jul 13, 2023
1 parent 34fd3c3 commit 2798a4a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,8 @@ func encode(stmt *Stmt, keySymbol string, srcOp Operand, trgtOp Operand) (code [
}
num := int32(intNum)
bytesNum := (*[4]byte)(unsafe.Pointer(&num))
regFieldN := trgtOp.(*register).toBits()
trgtRegi := trgtOp.(*register)
regFieldN := trgtRegi.toBits()
opcode := 0xb8 + regFieldN
code = append(Bytes(opcode), bytesNum[:]...)
return
Expand All @@ -483,7 +484,7 @@ func encode(stmt *Stmt, keySymbol string, srcOp Operand, trgtOp Operand) (code [
rex = REX_W
}
opcode := uint8(0xc7)
modRM := composeModRM(ModRegi, 0, trgtOp.(*register).toBits())
modRM := composeModRM(ModRegi, 0, trgtRegi.toBits())
code = Bytes(rex, opcode, modRM)
code = append(code, bytesNum[:]...)
return
Expand Down

0 comments on commit 2798a4a

Please sign in to comment.