// Reinit the Resource. Requires a *bitset.BitSet.
430303
func (r *AutoVLANCfgResource) Reinit(rsrcCfg interface{}) error {
	var ok bool
	prevVLANs := r.VLANs
	r.VLANs, ok = rsrcCfg.(*bitset.BitSet)
	if !ok {
		return core.Errorf("Invalid type for vlan resource config")
	}
	err := r.Write()
	if err != nil {
		return err
	}
	defer func() {
		if err != nil {
			r.Clear()
		}
	}()

	oper := &AutoVLANOperResource{}
	oper.StateDriver = r.StateDriver
	oper.ID = r.ID
	err = oper.Read(r.ID)
	if err != nil {
		return err
	}

	prevVLANs.InPlaceSymmetricDifference(oper.FreeVLANs)
	oper.FreeVLANs = r.VLANs
	for i, e := prevVLANs.NextSet(0); e; i, e = prevVLANs.NextSet(i + 1) {
		oper.FreeVLANs.Clear(i)
	}

	return oper.Write()
}
1092793
func (cs *ConnStats) Reset() {
	cs.lock.Lock()
	cs.RPCCalls = 0
	cs.RPCTime = 0
	cs.BytesWritten = 0
	cs.BytesRead = 0
	cs.WriteCalls = 0
	cs.WriteErrors = 0
	cs.ReadCalls = 0
	cs.ReadErrors = 0
	cs.DialCalls = 0
	cs.DialErrors = 0
	cs.AcceptCalls = 0
	cs.AcceptErrors = 0
	cs.lock.Unlock()
}
574768
func New(v ...bool) *Bitset {
	b := &Bitset{numBits: 0, bits: make([]byte, 0)}
	b.AppendBools(v...)

	return b
}
869845
func (d *State364) Reset() {
	d.pc = uint32(d.seed)
	d.pb = uint32(d.seed >> 32)
	d.clen = 0
	d.tail = nil
}
871404
func NewResourceSet(resources ...Resource) ResourceSet {
	resourceSet := make(ResourceSet)
	for _, resource := range resources {
		resourceSet.Add(resource)
	}

	return resourceSet
}
751036
func (s *Bitset) extend(index uint) {
	if index >= s.Length(0) {
		s.Length(index + 1)
	}
}
240795
func (rs *retryingSink) reset() {
	rs.failures.recent = 0
	rs.failures.last = time.Time{}
}
64364
func resetReplicaSet(dialInfo *mgo.DialInfo, memberHostPort string) error {
	params := peergrouper.InitiateMongoParams{
		DialInfo:       dialInfo,
		MemberHostPort: memberHostPort,
		User:           dialInfo.Username,
		Password:       dialInfo.Password,
	}
	return peergrouper.InitiateMongoServer(params)
}
351033
func (o *Once) Reset() {
	o.m.Lock()
	defer o.m.Unlock()
	atomic.StoreUint32(&o.done, 0)
}
998463
func Clone(from *Bitset) *Bitset {
	return &Bitset{numBits: from.numBits, bits: from.bits[:]}
}
1307340
func (cs *ConnStats) Reset() {
	atomic.StoreUint64(&cs.RPCCalls, 0)
	atomic.StoreUint64(&cs.RPCTime, 0)
	atomic.StoreUint64(&cs.BytesWritten, 0)
	atomic.StoreUint64(&cs.BytesRead, 0)
	atomic.StoreUint64(&cs.WriteCalls, 0)
	atomic.StoreUint64(&cs.WriteErrors, 0)
	atomic.StoreUint64(&cs.ReadCalls, 0)
	atomic.StoreUint64(&cs.ReadErrors, 0)
	atomic.StoreUint64(&cs.DialCalls, 0)
	atomic.StoreUint64(&cs.DialErrors, 0)
	atomic.StoreUint64(&cs.AcceptCalls, 0)
	atomic.StoreUint64(&cs.AcceptErrors, 0)
}
458066
func (b *Bitset) Set(index, value int) bool {
	if index < b.size {
		b.setImpl(index, value)
		return true
	}
	return false
}
240176
func (s *Storage) Reset() {
	s.setBuntDB(storage.TotalCountKey, 0)
	s.setBuntDB(storage.IosSuccessKey, 0)
	s.setBuntDB(storage.IosErrorKey, 0)
	s.setBuntDB(storage.AndroidSuccessKey, 0)
	s.setBuntDB(storage.AndroidErrorKey, 0)
}
218601
func (b *BitSet) DeleteAt(i uint) *BitSet {
	// the index of the slice element where we'll delete a bit
	deleteAtElement := i >> log2WordSize

	// generate a mask for the data that needs to be shifted right
	// within that slice element that gets modified
	dataMask := ^((uint64(1) << (i & (wordSize - 1))) - 1)

	// extract the data that we'll shift right from the slice element
	data := b.set[deleteAtElement] & dataMask

	// set the masked area to 0 while leaving the rest as it is
	b.set[deleteAtElement] &= ^dataMask

	// shift the previously extracted data to the right and then
	// set it in the previously masked area
	b.set[deleteAtElement] |= (data >> 1) & dataMask

	// loop over all the consecutive slice elements to copy each
	// lowest bit into the highest position of the previous element,
	// then shift the entire content to the right by 1
	for i := int(deleteAtElement) + 1; i < len(b.set); i++ {
		b.set[i-1] |= (b.set[i] & 1) << 63
		b.set[i] >>= 1
	}

	b.length = b.length - 1

	return b
}
128627
func (u *utxoStore) Reinit(utxos []dbtypes.UTXO) {
	u.Lock()
	defer u.Unlock()
	// Pre-allocate the transaction hash map assuming the number of unique
	// transaction hashes in input is roughly 2/3 of the number of UTXOs.
	prealloc := 2 * len(utxos) / 3
	u.c = make(map[string]map[uint32]*dbtypes.UTXOData, prealloc)
	for i := range utxos {
		u.set(utxos[i].TxHash, utxos[i].TxIndex, utxos[i].Addresses, utxos[i].Value)
	}
}
1313211
func (it *Not) Reset() {
	it.result = nil
	it.primaryIt.Reset()
	it.allIt.Reset()
}
1306241
func (s *Snmp) Reset() {
	atomic.StoreUint64(&s.BytesSent, 0)
	atomic.StoreUint64(&s.BytesReceived, 0)
	atomic.StoreUint64(&s.MaxConn, 0)
	atomic.StoreUint64(&s.ActiveOpens, 0)
	atomic.StoreUint64(&s.PassiveOpens, 0)
	atomic.StoreUint64(&s.CurrEstab, 0)
	atomic.StoreUint64(&s.InErrs, 0)
	atomic.StoreUint64(&s.InCsumErrors, 0)
	atomic.StoreUint64(&s.KCPInErrors, 0)
	atomic.StoreUint64(&s.InPkts, 0)
	atomic.StoreUint64(&s.OutPkts, 0)
	atomic.StoreUint64(&s.InSegs, 0)
	atomic.StoreUint64(&s.OutSegs, 0)
	atomic.StoreUint64(&s.InBytes, 0)
	atomic.StoreUint64(&s.OutBytes, 0)
	atomic.StoreUint64(&s.RetransSegs, 0)
	atomic.StoreUint64(&s.FastRetransSegs, 0)
	atomic.StoreUint64(&s.EarlyRetransSegs, 0)
	atomic.StoreUint64(&s.LostSegs, 0)
	atomic.StoreUint64(&s.RepeatSegs, 0)
	atomic.StoreUint64(&s.FECParityShards, 0)
	atomic.StoreUint64(&s.FECErrs, 0)
	atomic.StoreUint64(&s.FECRecovered, 0)
	atomic.StoreUint64(&s.FECShortShards, 0)
}