// formatBits computes the string representation of u in the given base.
// If neg is set, u is treated as negative int64 value. If append_ is
// set, the string is appended to dst and the resulting byte slice is
// returned as the first result value; otherwise the string is returned
// as the second result value.
//
formatBits computes the string representation of u in the given base.
If neg is set, u is treated as negative int64 value. If append_ is
set, the string is appended to dst and the resulting byte slice is
returned as the first result value; otherwise the string is returned
as the second result value.
// formatBits computes the string representation of u in the given base . // If neg is set u is treated as negative int64 value . If append_ is // set the string is appended to dst and the resulting byte slice is // returned as the first result value ; otherwise the string is returned // as the second result value . //
func formatBits(dst []byte, u uint64, base int, neg, append_ bool) (d []byte, s string) {
	if base < 2 || base > len(digits) {
		panic("strconv: illegal AppendInt/FormatInt base")
	}
	var a [64 + 1]byte 
	i := len(a)
	if neg {
		u = -u
	}
	if base == 10 {
		for u >= 100 {
			i -= 2
			q := u / 100
			j := uintptr(u - q*100)
			a[i+1] = digits01[j]
			a[i+0] = digits10[j]
			u = q
		}
		if u >= 10 {
			i--
			q := u / 10
			a[i] = digits[uintptr(u-q*10)]
			u = q
		}
	} else if s := shifts[base]; s > 0 {
		b := uint64(base)
		m := uintptr(b) - 1 
		for u >= b {
			i--
			a[i] = digits[uintptr(u)&m]
			u >>= s
		}
	} else {
		b := uint64(base)
		for u >= b {
			i--
			a[i] = digits[uintptr(u%b)]
			u /= b
		}
	}
	i--
	a[i] = digits[uintptr(u)]
	if neg {
		i--
		a[i] = '-'
	}
	if append_ {
		d = append(dst, a[i:]...)
		return
	}
	s = string(a[i:])
	return
}
func formatBits ( dst [ ] byte , u uint64 , base int , neg , append_ bool ) ( d [ ] byte , s string ) { if base < 2 || base > len ( digits ) { panic ( " " ) } var a [ 64 + 1 ] byte i := len ( a ) if neg { u = - u } if base == 10 { for u >= 100 { i -= 2 q := u / 100 j := uintptr ( u - q * 100 ) a [ i + 1 ] = digits01 [ j ] a [ i + 0 ] = digits10 [ j ] u = q } if u >= 10 { i -- q := u / 10 a [ i ] = digits [ uintptr ( u - q * 10 ) ] u = q } } else if s := shifts [ base ] ; s > 0 { b := uint64 ( base ) m := uintptr ( b ) - 1 for u >= b { i -- a [ i ] = digits [ uintptr ( u ) & m ] u >>= s } } else { b := uint64 ( base ) for u >= b { i -- a [ i ] = digits [ uintptr ( u % b ) ] u /= b } } i -- a [ i ] = digits [ uintptr ( u ) ] if neg { i -- a [ i ] = '-' } if append_ { d = append ( dst , a [ i : ] ... ) return } s = string ( a [ i : ] ) return }
formatBits computes the string representation of u in the given base.
formatBits computes the string representation of u in the given base .
// 2 <= base && base <= len(digits) // +1 for sign of 64bit value in base 2 // convert bits // common case: use constants for / and % because // the compiler can optimize it into a multiply+shift, // and unroll loop // base is power of 2: use shifts and masks instead of / and % // == 1<<s - 1 // general case // u < base // add sign, if any