示例#1
0
文件: sdc.go 项目: robskie/sdc
func (a *Array) init() {
	a.bits = bit.NewArray(0)

	selOpts := &ranksel.Options{Sr: sr, Ss: ss}
	a.selector = ranksel.NewBitVector(selOpts)
	a.selector.Add(1, 1)

	a.initialized = true
}
示例#2
0
文件: sdc.go 项目: robskie/sdc
// GobDecode populates this array from gob streams.
func (a *Array) GobDecode(data []byte) error {
	buf := bytes.NewReader(data)
	dec := gob.NewDecoder(buf)

	a.bits = bit.NewArray(0)
	a.selector = ranksel.NewBitVector(nil)
	err := checkErr(
		dec.Decode(a.bits),
		dec.Decode(a.selector),
		dec.Decode(&a.length),
		dec.Decode(&a.initialized),
	)

	if err != nil {
		err = fmt.Errorf("sdc: decode failed (%v)", err)
	}

	return err
}