diff options
| author | Russ Cox <rsc@golang.org> | 2008-12-18 22:37:22 -0800 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2008-12-18 22:37:22 -0800 |
| commit | 89995dcecf37b9a21c26783dcf8ab506da237363 (patch) | |
| tree | 851fad01a87b8fa071ed46fa0985f1857d9e47ca /src/lib/strconv | |
| parent | 924e27f38d133bc7c9978a061b20f950554434ee (diff) | |
| download | golang-89995dcecf37b9a21c26783dcf8ab506da237363.tar.gz | |
convert *[] to [].
R=r
OCL=21563
CL=21571
Diffstat (limited to 'src/lib/strconv')
| -rw-r--r-- | src/lib/strconv/decimal.go | 20 | ||||
| -rw-r--r-- | src/lib/strconv/ftoa.go | 2 | ||||
| -rw-r--r-- | src/lib/strconv/itoa.go | 4 |
3 files changed, 13 insertions, 13 deletions
diff --git a/src/lib/strconv/decimal.go b/src/lib/strconv/decimal.go index b30c842ff..d22d4526c 100644 --- a/src/lib/strconv/decimal.go +++ b/src/lib/strconv/decimal.go @@ -27,8 +27,8 @@ func (a *Decimal) RoundDown(nd int) *Decimal; func (a *Decimal) RoundedInteger() uint64; -func Copy(dst *[]byte, src *[]byte) int; -func DigitZero(dst *[]byte) int; +func Copy(dst []byte, src []byte) int; +func DigitZero(dst []byte) int; func (a *Decimal) String() string { n := 10 + a.nd; @@ -52,31 +52,31 @@ func (a *Decimal) String() string { buf[w] = '.'; w++; w += DigitZero(buf[w:w+-a.dp]); - w += Copy(buf[w:w+a.nd], (&a.d)[0:a.nd]); + w += Copy(buf[w:w+a.nd], a.d[0:a.nd]); case a.dp < a.nd: // decimal point in middle of digits - w += Copy(buf[w:w+a.dp], (&a.d)[0:a.dp]); + w += Copy(buf[w:w+a.dp], a.d[0:a.dp]); buf[w] = '.'; w++; - w += Copy(buf[w:w+a.nd-a.dp], (&a.d)[a.dp:a.nd]); + w += Copy(buf[w:w+a.nd-a.dp], a.d[a.dp:a.nd]); default: // zeros fill space between digits and decimal point - w += Copy(buf[w:w+a.nd], (&a.d)[0:a.nd]); + w += Copy(buf[w:w+a.nd], a.d[0:a.nd]); w += DigitZero(buf[w:w+a.dp-a.nd]); } return string(buf[0:w]); } -func Copy(dst *[]byte, src *[]byte) int { +func Copy(dst []byte, src []byte) int { for i := 0; i < len(dst); i++ { dst[i] = src[i]; } return len(dst); } -func DigitZero(dst *[]byte) int { +func DigitZero(dst []byte) int { for i := 0; i < len(dst); i++ { dst[i] = '0'; } @@ -236,7 +236,7 @@ var leftcheat = []LeftCheat { } // Is the leading prefix of b lexicographically less than s? -func PrefixIsLessThan(b *[]byte, s string) bool { +func PrefixIsLessThan(b []byte, s string) bool { for i := 0; i < len(s); i++ { if i >= len(b) { return true; @@ -251,7 +251,7 @@ func PrefixIsLessThan(b *[]byte, s string) bool { // Binary shift left (/ 2) by k bits. k <= MaxShift to avoid overflow. func LeftShift(a *Decimal, k uint) { delta := leftcheat[k].delta; - if PrefixIsLessThan((&a.d)[0:a.nd], leftcheat[k].cutoff) { + if PrefixIsLessThan(a.d[0:a.nd], leftcheat[k].cutoff) { delta--; } diff --git a/src/lib/strconv/ftoa.go b/src/lib/strconv/ftoa.go index c1c8af317..0b6a616d1 100644 --- a/src/lib/strconv/ftoa.go +++ b/src/lib/strconv/ftoa.go @@ -380,7 +380,7 @@ func FmtB(neg bool, mant uint64, exp int, flt *FloatInfo) string { w--; buf[w] = '-'; } - return string((&buf)[w:len(buf)]); + return string(buf[w:len(buf)]); } func Max(a, b int) int { diff --git a/src/lib/strconv/itoa.go b/src/lib/strconv/itoa.go index 6bf269207..698c553d2 100644 --- a/src/lib/strconv/itoa.go +++ b/src/lib/strconv/itoa.go @@ -28,8 +28,8 @@ export func itoa64(i int64) string { b[bp] = '-' } - // BUG return string(b[bp:len(b)]) - return string((&b)[bp:len(b)]) + return string(b[bp:len(b)]) + //return string((&b)[bp:len(b)]) } export func itoa(i int) string { |
