// %b: -ddddddddp±ddd
422599
func fmtB(dst EncodingBuffer, neg bool, mant uint64, exp int, flt *floatInfo) {
	// sign
	if neg {
		dst.WriteByte('-')
	}

	// mantissa
	formatBits(dst, mant, 10, false)

	// p
	dst.WriteByte('p')

	// ±exponent
	exp -= int(flt.mantbits)
	if exp >= 0 {
		dst.WriteByte('+')
	}
	formatBits(dst, uint64(exp), 10, exp < 0)

	return
}
64110
func bgraModel(c color.Color) color.Color {
	if _, ok := c.(BGRA); ok {
		return c
	}

	r, g, b, a := c.RGBA()
	return BGRA{
		B: uint8(b >> 8),
		G: uint8(g >> 8),
		R: uint8(r >> 8),
		A: uint8(a >> 8),
	}
}
509574
func (i *InverseBloomFilter) GobDecode(data []byte) error {
	buf := bytes.NewBuffer(data)
	_, err := i.ReadFrom(buf)
	return err
}
165325
func (sr SampleRate) D(n int) time.Duration {
	return time.Second * time.Duration(n) / time.Duration(sr)
}
699873
func (d *simpleDecDriver) DecodeBool() (b bool) {
	if !d.bdRead {
		d.readNextBd()
	}
	if d.bd == simpleVdTrue {
		b = true
	} else if d.bd == simpleVdFalse {
	} else {
		d.d.errorf("cannot decode bool - %s: %x", msgBadDesc, d.bd)
		return
	}
	d.bdRead = false
	return
}
640466
func Bytes(b0, b1 []byte) int {
	d := 0
	for i, x := range b0 {
		d += Byte(x, b1[i])
	}
	return d
}
241277
func GenSubID() string {
	bs := make([]byte, 32)
	rand.Read(bs)
	return hex.EncodeUpperToString(bs)
}
842731
func Hexdumpf(m *dns.Msg, format string, v ...interface{}) {
	if !log.D {
		return
	}

	buf, _ := m.Pack()
	if len(buf) == 0 {
		return
	}

	format += "\n%s"
	v = append(v, hexdump(buf))
	log.Debugf(format, v...)
}
413552
func IDHexDecode(s string) (ID, error) {
	m, err := mh.FromHexString(s)
	if err != nil {
		return "", err
	}
	return ID(m), err
}
1038851
func (h *HyperLogLog) GobDecode(b []byte) error {
	dec := gob.NewDecoder(bytes.NewBuffer(b))
	if err := dec.Decode(&h.reg); err != nil {
		return err
	}
	if err := dec.Decode(&h.m); err != nil {
		return err
	}
	if err := dec.Decode(&h.p); err != nil {
		return err
	}
	return nil
}
1095744
func decodeUUIDBinary(src []byte) ([]byte, error) {
	if len(src) != 16 {
		return nil, fmt.Errorf("pq: unable to decode uuid; bad length: %d", len(src))
	}

	dst := make([]byte, 36)
	dst[8], dst[13], dst[18], dst[23] = '-', '-', '-', '-'
	hex.Encode(dst[0:], src[0:4])
	hex.Encode(dst[9:], src[4:6])
	hex.Encode(dst[14:], src[6:8])
	hex.Encode(dst[19:], src[8:10])
	hex.Encode(dst[24:], src[10:16])

	return dst, nil
}
338815
func (c *ConfigDataNode) GobDecode(buf []byte) error {
	r := bytes.NewBuffer(buf)
	c.mutex = new(sync.Mutex)
	decoder := gob.NewDecoder(r)
	return decoder.Decode(&c.table)
}
737135
func (dd *dictDecoder) LastBytes() (p1, p2 byte) {
	if dd.wrPos > 1 {
		return dd.hist[dd.wrPos-1], dd.hist[dd.wrPos-2]
	} else if dd.wrPos > 0 {
		return dd.hist[dd.wrPos-1], dd.hist[len(dd.hist)-1]
	} else {
		return dd.hist[len(dd.hist)-1], dd.hist[len(dd.hist)-2]
	}
}
899394
func (pdbg *Pdbg) Pdbgf(format string, args ...interface{}) string {
	return pdbg.pdbgfw(format, pdbg.Err(), args...)
}
909676
func BoundedDigits(digits, low, high int) string {
	if low > high {
		low, high = high, low
	}

	max := int(math.Pow10(digits)) - 1
	if high > max {
		high = max
	}

	num := privateRand.Intn(high-low+1) + low
	format := fmt.Sprintf("%%0%dd", digits)
	return fmt.Sprintf(format, num)
}
271775
func fastXORBytes(dst, a, b []byte) int {
	n := len(a)
	if len(b) < n {
		n = len(b)
	}
	w := n / wordSize
	if w > 0 {
		dw := *(*[]uintptr)(unsafe.Pointer(&dst))
		aw := *(*[]uintptr)(unsafe.Pointer(&a))
		bw := *(*[]uintptr)(unsafe.Pointer(&b))
		for i := 0; i < w; i++ {
			dw[i] = aw[i] ^ bw[i]
		}
	}
	for i := n - n%wordSize; i < n; i++ {
		dst[i] = a[i] ^ b[i]
	}
	return n
}
1212615
func decodeRGB(dinfo *C.struct_jpeg_decompress_struct) (dest *rgb.Image, err error) {
	C.jpeg_calc_output_dimensions(dinfo)
	dest = rgb.NewImage(image.Rect(0, 0, int(dinfo.output_width), int(dinfo.output_height)))

	dinfo.out_color_space = C.JCS_RGB
	readScanLines(dinfo, dest.Pix, dest.Stride)
	return
}