// SetBit64 set the specified bit to 1 for 64-bit value and return the new value
492588
func SetBit64(value uint64, pos uint) (uint64, error) {
    if pos >= 64 {
        return value, fmt.Errorf("invalid position(%v)", pos)
    }
    return (value | (uint64(1) << pos)), nil
}
825599
func SetField64(value uint64, high uint, low uint, field uint64) (uint64, error) {
    if high > 63  || low > 63 || high < low {
        return value, fmt.Errorf("invalid high(%v) or low(%v)", high, low);
    }

    return deposit64(value, low, high - low + 1, field)
}
823352
func (e *BooleanDecoder) SetBytes(b []byte) {
	if len(b) == 0 {
		return
	}

	// First byte stores the encoding type, only have 1 bit-packet format
	// currently ignore for now.
	b = b[1:]
	count, n := binary.Uvarint(b)
	if n <= 0 {
		e.err = fmt.Errorf("booleanDecoder: invalid count")
		return
	}

	e.b = b[n:]
	e.i = -1
	e.n = int(count)

	if min := len(e.b) * 8; min < e.n {
		// Shouldn't happen - TSM file was truncated/corrupted
		e.n = min
	}
}
1369387
func (i *Int64) Set(value int64) {
	i.lock.Lock()
	defer i.lock.Unlock()
	i.increment = value
}
664715
func (s *Mp2Settings) SetBitrate(v float64) *Mp2Settings {
	s.Bitrate = &v
	return s
}
1043196
func (s *AiffSettings) SetBitDepth(v int64) *AiffSettings {
	s.BitDepth = &v
	return s
}
739957
func (d *Datum) SetInt64(i int64) {
	d.k = KindInt64
	d.i = i
}
632361
func (dec *Decoder) Int64(v *int64) error {
	err := dec.decodeInt64(v)
	if err != nil {
		return err
	}
	dec.called |= 1
	return nil
}
1174756
func (b *OpenBitSet) NextSetBit(index int64) int64 {
	assert(index >= 0)
	i := int(uint64(index) >> 6)
	if i >= b.wlen {
		return -1
	}
	subIndex := int(index & 0x3f)                      // index within the word
	word := int64(uint64(b.bits[i]) >> uint(subIndex)) // skip all the bits to the right of index

	if word != 0 {
		return (int64(i) << 6) + int64(subIndex) + int64(NumberOfTrailingZeros(word))
	}

	for i++; i < b.wlen; i++ {
		word = b.bits[i]
		if word != 0 {
			return (int64(i) << 6) + int64(NumberOfTrailingZeros(word))
		}
	}

	return -1
}
156508
func sliceBits64(x uint64, high, low uint8) uint64 {
	return (x << (63 - high)) >> (low + (63 - high))
}
73345
func (f *fragment) setBit(rowID, columnID uint64) (changed bool, err error) {
	f.mu.Lock()
	defer f.mu.Unlock()
	mustClose, err := f.reopen()
	if err != nil {
		return false, errors.Wrap(err, "reopening")
	}
	if mustClose {
		defer f.safeClose()
	}

	// handle mutux field type
	if f.mutexVector != nil {
		if err := f.handleMutex(rowID, columnID); err != nil {
			return changed, errors.Wrap(err, "handling mutex")
		}
	}

	return f.unprotectedSetBit(rowID, columnID)
}
1191585
func (f *int64SliceFlag) Set(val string) error {
	i, err := strconv.ParseInt(val, 10, 64)
	if err != nil {
		return errors.Reason("values must be 64-bit integers").Err()
	}
	*f = append(*f, i)
	return nil
}
474867
func (z *Big) SetUint64(x uint64) *Big {
	z.compact = x
	if x == c.Inflated {
		z.unscaled.SetUint64(x)
	}
	z.precision = arith.Length(x)
	z.exp = 0
	z.form = finite
	return z
}
510492
func BEUvarint64(i uint64) []byte {
	dst := [8]byte{}
	binary.BigEndian.PutUint64(dst[:], i)
	return dst[:]
}
328191
func (ba *bitArray) ClearBit(k uint64) error {
	if k >= ba.Capacity() {
		return OutOfRangeError(k)
	}

	if !ba.anyset { // nothing is set, might as well bail
		return nil
	}

	i, pos := getIndexAndRemainder(k)
	ba.blocks[i] &^= block(1 << pos)

	if k == ba.highest {
		ba.setHighest()
	} else if k == ba.lowest {
		ba.setLowest()
	}
	return nil
}
460847
func (dec *Decoder) Uint64(v *uint64) error {
	err := dec.decodeUint64(v)
	if err != nil {
		return err
	}
	dec.called |= 1
	return nil
}
478193
func (p *ProgressBar) Set64(num int64) error {
	p.lock.Lock()
	defer p.lock.Unlock()

	if p.config.max == 0 {
		return errors.New("max must be greater than 0")
	}
	p.state.currentNum = num
	percent := float64(p.state.currentNum) / float64(p.config.max)
	p.state.currentSaucerSize = int(percent * float64(p.config.width))
	p.state.currentPercent = int(percent * 100)
	updateBar := p.state.currentPercent != p.state.lastPercent && p.state.currentPercent > 0

	p.state.currentBytes = float64(percent) * float64(p.config.maxBytes)
	p.state.lastPercent = p.state.currentPercent
	if p.state.currentNum > p.config.max {
		return errors.New("current number exceeds max")
	}

	// always update if show bytes/second or its/second
	if updateBar || p.config.showIterationsPerSecond || p.config.maxBytes > 0 {
		return p.render()
	}

	return nil
}