package abi
type BoundsErrorCode uint8
const (
BoundsIndex BoundsErrorCode = iota
BoundsSliceAlen
BoundsSliceAcap
BoundsSliceB
BoundsSlice3Alen
BoundsSlice3Acap
BoundsSlice3B
BoundsSlice3C
BoundsConvert
numBoundsCodes
)
const (
BoundsMaxReg = 15
BoundsMaxConst = 31
)
func ( BoundsErrorCode, , , bool, , int) int {
:= int(0)
if {
|= 1 << 0
if {
|= 1 << 2
}
if < 0 || > BoundsMaxReg {
panic("bad xReg")
}
|= << 3
} else {
if < 0 || > BoundsMaxConst {
panic("bad xConst")
}
|= << 2
}
if {
|= 1 << 1
if < 0 || > BoundsMaxReg {
panic("bad yReg")
}
|= << 7
} else {
if < 0 || > BoundsMaxConst {
panic("bad yConst")
}
|= << 7
}
return *int(numBoundsCodes) + int()
}
func ( int) ( BoundsErrorCode, , , bool, , int) {
= BoundsErrorCode( % int(numBoundsCodes))
:= / int(numBoundsCodes)
= &1 != 0
>>= 1
= &1 != 0
>>= 1
if {
= &1 != 0
>>= 1
= & 0xf
>>= 4
} else {
= & 0x1f
>>= 5
}
if {
= & 0xf
>>= 4
} else {
= & 0x1f
>>= 5
}
if != 0 {
panic("BoundsDecode decoding error")
}
return
}