Commit 2de06655 authored by Robert Griesemer's avatar Robert Griesemer

big: removed some gratuitous +/-1's

R=mtj, bradfitz
CC=golang-dev
https://golang.org/cl/4584046
parent 636c5fac
......@@ -764,13 +764,12 @@ func (x nat) string(charset string) string {
if b == b&-b {
// shift is base-b digit size in bits
shift := uint(trailingZeroBits(b)) // shift > 0 because b >= 2
m := len(x)
mask := Word(1)<<shift - 1
w := x[0]
nbits := uint(_W) // number of unprocessed bits in w
// convert less-significant words
for k := 0; k < m-1; k++ {
for k := 1; k < len(x); k++ {
// convert full digits
for nbits >= shift {
i--
......@@ -782,16 +781,16 @@ func (x nat) string(charset string) string {
// convert any partial leading digit and advance to next word
if nbits == 0 {
// no partial digit remaining, just advance
w = x[k+1]
w = x[k]
nbits = _W
} else {
// partial digit in current (k) and next (k+1) word
w |= x[k+1] << nbits
// partial digit in current (k-1) and next (k) word
w |= x[k] << nbits
i--
s[i] = charset[w&mask]
// advance
w = x[k+1] >> (shift - nbits)
w = x[k] >> (shift - nbits)
nbits = _W - (shift - nbits)
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment