func (op OpCode) Endianness() Endianness {
	if op.ALUOp() != Swap {
		return InvalidEndian
	}
	return Endianness(op & endianMask)
}
Endianness returns the Endianness for a byte swap instruction.
package asm
import (
	"fmt"
	"strings"
)
type encoding int
const (
	unknownEncoding encoding = iota
	loadOrStore
	jumpOrALU
)
type Class uint8
const classMask OpCode = 0x07
const (
	LdClass Class = 0x00
	LdXClass Class = 0x01
	StClass Class = 0x02
	StXClass Class = 0x03
	ALUClass Class = 0x04
	JumpClass Class = 0x05
	ALU64Class Class = 0x07
)
func (cls Class) encoding() encoding {
	switch cls {
	case LdClass, LdXClass, StClass, StXClass:
		return loadOrStore
	case ALU64Class, ALUClass, JumpClass:
		return jumpOrALU
	default:
		return unknownEncoding
	}
}
type OpCode uint8
const InvalidOpCode OpCode = 0xff
func (op OpCode) rawInstructions() int {
	if op.IsDWordLoad() {
		return 2
	}
	return 1
}
func (op OpCode) IsDWordLoad() bool {
	return op == LoadImmOp(DWord)
}
func (op OpCode) Class() Class {
	return Class(op & classMask)
}
func (op OpCode) Mode() Mode {
	if op.Class().encoding() != loadOrStore {
		return InvalidMode
	}
	return Mode(op & modeMask)
}
func (op OpCode) Size() Size {
	if op.Class().encoding() != loadOrStore {
		return InvalidSize
	}
	return Size(op & sizeMask)
}
func (op OpCode) Source() Source {
	if op.Class().encoding() != jumpOrALU || op.ALUOp() == Swap {
		return InvalidSource
	}
	return Source(op & sourceMask)
}
func (op OpCode) ALUOp() ALUOp {
	if op.Class().encoding() != jumpOrALU {
		return InvalidALUOp
	}
	return ALUOp(op & aluMask)
}