mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-04 01:54:28 +00:00
41ee460a27
* optimize codeBitmap * add lru * remove custom lru * jumpDests as explocit parameter * lint * lint * linters * default jumpDestsCache * remove common.rand
25 lines
466 B
Go
25 lines
466 B
Go
package pool
|
|
|
|
import "github.com/valyala/bytebufferpool"
|
|
|
|
type ByteBuffer struct {
|
|
*bytebufferpool.ByteBuffer
|
|
}
|
|
|
|
func (b ByteBuffer) Get(pos int) byte {
|
|
return b.B[pos]
|
|
}
|
|
|
|
func (b ByteBuffer) SetBitPos(pos uint64) {
|
|
b.B[pos/8] |= 0x80 >> (pos % 8)
|
|
}
|
|
|
|
func (b ByteBuffer) SetBit8Pos(pos uint64) {
|
|
b.B[pos/8] |= 0xFF >> (pos % 8)
|
|
b.B[pos/8+1] |= ^(0xFF >> (pos % 8))
|
|
}
|
|
|
|
func (b ByteBuffer) CodeSegment(pos uint64) bool {
|
|
return b.B[pos/8]&(0x80>>(pos%8)) == 0
|
|
}
|