Example #1
0
File: sdc.go Project: 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
}
Example #2
0
File: sdc.go Project: 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
}