// SetBit sets the bit to the data.
352471
func (db *DB) SetBit(key []byte, offset int, on int) (int64, error) {
	if err := checkKeySize(key); err != nil {
		return 0, err
	}

	if (on & ^1) != 0 {
		return 0, fmt.Errorf("bit must be 0 or 1, not %d", on)
	}

	t := db.kvBatch

	t.Lock()
	defer t.Unlock()

	key = db.encodeKVKey(key)
	value, err := db.bucket.Get(key)
	if err != nil {
		return 0, err
	}

	byteOffset := int(uint32(offset) >> 3)
	extra := byteOffset + 1 - len(value)
	if extra > 0 {
		value = append(value, make([]byte, extra)...)
	}

	byteVal := value[byteOffset]
	bit := 7 - uint8(uint32(offset)&0x7)
	bitVal := byteVal & (1 << bit)

	byteVal &= ^(1 << bit)
	byteVal |= (uint8(on&0x1) << bit)

	value[byteOffset] = byteVal

	t.Put(key, value)
	if err := t.Commit(); err != nil {
		return 0, err
	}

	if bitVal > 0 {
		return 1, nil
	}

	return 0, nil
}
837623
func (f *ScmpFilter) SetLogBit(state bool) error {
	var toSet C.uint32_t = 0x0

	if state {
		toSet = 0x1
	}

	err := f.setFilterAttr(filterAttrLog, toSet)
	if err != nil {
		api, apiErr := getApi()
		if (apiErr != nil && api == 0) || (apiErr == nil && api < 3) {
			return fmt.Errorf("setting the log bit is only supported in libseccomp 2.4.0 and newer with API level 3 or higher")
		}
	}

	return err
}
1043196
func (s *AiffSettings) SetBitDepth(v int64) *AiffSettings {
	s.BitDepth = &v
	return s
}
1023362
func (s *Ac3Settings) SetBitrate(v int64) *Ac3Settings {
	s.Bitrate = &v
	return s
}
242021
func (r *Row) clearBit(i uint64) (changed bool) { // nolint: unparam
	s := r.segment(i / ShardWidth)
	if s == nil {
		return false
	}
	return s.ClearBit(i)
}
1176403
func (bA *BitArray) SetIndex(i int, v bool) bool {
	if bA == nil {
		return false
	}
	bA.mtx.Lock()
	defer bA.mtx.Unlock()
	return bA.setIndex(i, v)
}
1095488
func (s *VideoParameters) SetBitRate(v string) *VideoParameters {
	s.BitRate = &v
	return s
}
1277954
func (s *Eac3Settings) SetBitrate(v int64) *Eac3Settings {
	s.Bitrate = &v
	return s
}
473128
func setBit(n int, pos int) int {
	n |= (1 << uint(pos))
	return n
}
925474
func (ini *INI) SetInt(key string, value int) {
    ini.SectionSetInt(DefaultSection, key, value)
}
167584
func (s *Mpeg2Settings) SetBitrate(v int64) *Mpeg2Settings {
	s.Bitrate = &v
	return s
}
728322
func (b *Bitset) SetAll(value int) {
	for i := 0; i < b.size; i++ {
		b.setImpl(i, value)
	}
}
1355066
func (bl *BitList) AddBit(bits ...bool) {
	for _, bit := range bits {
		itmIndex := bl.count / 32
		for itmIndex >= len(bl.data) {
			bl.grow()
		}
		bl.SetBit(bl.count, bit)
		bl.count++
	}
}
1354951
func (s *GetPartitionsInput) SetSegment(v *Segment) *GetPartitionsInput {
	s.Segment = v
	return s
}
327093
func (s *AttributeValue) SetB(v []byte) *AttributeValue {
	s.B = v
	return s
}
880036
func (me *PriorityBitmap) Set(bit int, priority int) bool {
	if p, ok := me.priorities[bit]; ok && p == priority {
		return false
	}
	if oldPriority, deleted := me.deleteBit(bit); deleted && oldPriority == priority {
		panic("should have already returned")
	}
	if me.priorities == nil {
		me.priorities = make(map[int]int)
	}
	me.priorities[bit] = priority
	if me.om == nil {
		me.om = orderedmap.New(bitLess)
	}
	_v, ok := me.om.GetOk(priority)
	if !ok {
		// No other bits with this priority, set it to a lone int.
		me.om.Set(priority, bit)
		return true
	}
	switch v := _v.(type) {
	case int:
		newV := bitSets.Get().(map[int]struct{})
		newV[v] = struct{}{}
		newV[bit] = struct{}{}
		me.om.Set(priority, newV)
	case map[int]struct{}:
		v[bit] = struct{}{}
	default:
		panic(v)
	}
	return true
}
716738
func (v *view) setBit(rowID, columnID uint64) (changed bool, err error) {
	shard := columnID / ShardWidth
	frag, err := v.CreateFragmentIfNotExists(shard)
	if err != nil {
		return changed, err
	}
	return frag.setBit(rowID, columnID)
}