mirror of https://github.com/go-gitea/gitea
Git with a cup of tea, painless self-hosted git service
Mirror for internal git.with.parts use
https://git.with.parts
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
489 B
20 lines
489 B
7 years ago
|
package roaring
|
||
|
|
||
|
import (
|
||
|
"encoding/binary"
|
||
|
"io"
|
||
|
)
|
||
|
|
||
|
// writeTo for runContainer16 follows this
|
||
|
// spec: https://github.com/RoaringBitmap/RoaringFormatSpec
|
||
|
//
|
||
|
func (b *runContainer16) writeTo(stream io.Writer) (int, error) {
|
||
|
buf := make([]byte, 2+4*len(b.iv))
|
||
|
binary.LittleEndian.PutUint16(buf[0:], uint16(len(b.iv)))
|
||
|
for i, v := range b.iv {
|
||
|
binary.LittleEndian.PutUint16(buf[2+i*4:], v.start)
|
||
|
binary.LittleEndian.PutUint16(buf[2+2+i*4:], v.length)
|
||
|
}
|
||
|
return stream.Write(buf)
|
||
|
}
|