本文整理匯總了Golang中github.com/tsavola/wag/internal/gen.OpCoder.WriteByte方法的典型用法代碼示例。如果您正苦於以下問題:Golang OpCoder.WriteByte方法的具體用法?Golang OpCoder.WriteByte怎麽用?Golang OpCoder.WriteByte使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/tsavola/wag/internal/gen.OpCoder
的用法示例。
在下文中一共展示了OpCoder.WriteByte方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: op
func (i insnO) op(code gen.OpCoder, reg regs.R) {
if reg >= 8 {
panic("register not supported by instruction")
}
code.WriteByte(i.opbase + byte(reg))
}
示例2: writeSibTo
func writeSibTo(code gen.OpCoder, scale byte, index, base regs.R) {
if scale >= 4 {
panic("scale factor out of bounds")
}
code.WriteByte((scale << 6) | (byte(index&7) << 3) | byte(base&7))
}
示例3: opImm
func (i insnPrefixMI) opImm(code gen.OpCoder, t types.T, reg regs.R, value int32) {
opcode, imm := i.immOpcode(value)
i.prefix.writeTo(code, t, 0, 0, byte(reg))
code.WriteByte(opcode)
writeModTo(code, ModReg, i.ro, byte(reg))
imm.writeTo(code)
}
示例4: opImmToStack
func (i insnPrefixMI) opImmToStack(code gen.OpCoder, t types.T, disp, value int32) {
mod, immDisp := dispMod(t, regStackPtr, disp)
opcode, immValue := i.immOpcode(value)
i.prefix.writeTo(code, t, 0, 0, 0)
code.WriteByte(opcode)
writeModTo(code, mod, i.ro, MemSIB)
writeSibTo(code, 0, regStackPtr, regStackPtr)
immDisp.writeTo(code)
immValue.writeTo(code)
}
示例5: writeRexTo
func writeRexTo(code gen.OpCoder, rex, ro, index, rmOrBase byte) {
if ro >= 8 {
rex |= rexR
}
if index >= 8 {
rex |= rexX
}
if rmOrBase >= 8 {
rex |= rexB
}
if rex != 0 {
code.WriteByte(rex)
}
}
示例6: opImmToIndirect
func (i insnPrefixMI) opImmToIndirect(code gen.OpCoder, t types.T, scale uint8, index, base regs.R, disp, value int32) {
mod, immDisp := dispMod(t, base, disp)
opcode, immValue := i.immOpcode(value)
i.prefix.writeTo(code, t, 0, byte(index), byte(base))
code.WriteByte(opcode)
if scale == 0 && index == NoIndex && base != 12 {
writeModTo(code, mod, i.ro, byte(base))
} else {
writeModTo(code, mod, i.ro, MemSIB)
writeSibTo(code, scale, index, base)
}
immDisp.writeTo(code)
immValue.writeTo(code)
}
示例7: writeModTo
func writeModTo(code gen.OpCoder, mod mod, ro, rm byte) {
code.WriteByte(byte(mod) | ((ro & 7) << 3) | (rm & 7))
}
示例8: opReg
func (i insnSuffixRMI) opReg(code gen.OpCoder, t types.T, target, source regs.R, value int8) {
code.Write(i.opcode)
i.suffix.writeTo(code, t, byte(target), 0, byte(source))
writeModTo(code, ModReg, byte(target), byte(source))
code.WriteByte(uint8(value))
}
示例9: opImm8
func (i insnPrefixMI) opImm8(code gen.OpCoder, t types.T, reg regs.R, value uint8) {
i.prefix.writeTo(code, t, 0, 0, byte(reg))
code.WriteByte(i.opcode8)
writeModTo(code, ModReg, i.ro, byte(reg))
code.WriteByte(value)
}
示例10: writeTo
func (data16RexSizePrefix) writeTo(code gen.OpCoder, t types.T, ro, index, rmOrBase byte) {
code.WriteByte(0x66)
writeRexSizeTo(code, t, ro, index, rmOrBase)
}