func NewChunkQ(size int64, chunk int64) *ChunkQ { if !powerOfTwo(size) { panic(fmt.Sprintf("Size must be a power of two, size = %d", size)) } if size%chunk != 0 { panic(fmt.Sprintf("Size must be neatly divisible by chunk, (size) %d rem (chunk) %d = %d", size, chunk, size%chunk)) } ringBuffer := padded.ByteSlice(int(size)) readBuffer := padded.ByteSlice(int(chunk)) writeBuffer := padded.ByteSlice(int(chunk)) q := &ChunkQ{ringBuffer: ringBuffer, readBuffer: readBuffer, writeBuffer: writeBuffer, size: size, chunk: chunk, mask: size - 1} return q }
func NewByteChunkQ(size, chunk int64) *ByteChunkQ { if size%chunk != 0 { panic(fmt.Sprintf("Size must be neatly divisible by chunk, (size) %d rem (chunk) %d = %d", size, chunk, size%chunk)) } ringBuffer := padded.ByteSlice(int(size)) q := &ByteChunkQ{ringBuffer: ringBuffer, commonQ: newCommonQ(size), chunk: chunk} return q }
func NewByteQ(size int64) *ByteQ { if !powerOfTwo(size) { panic(fmt.Sprintf("Size (%d) must be a power of two", size)) } ringBuffer := padded.ByteSlice(int(size)) q := &ByteQ{ringBuffer: ringBuffer, size: size, mask: size - 1} return q }
func NewByteQ(size int64) *ByteQ { ringBuffer := padded.ByteSlice(int(size)) q := &ByteQ{ringBuffer: ringBuffer, commonQ: newCommonQ(size)} return q }