Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(278)

Delta Between Two Patch Sets: src/pkg/strconv/itoa.go

Issue 1702050: code review 1702050: strconv.Uitob64: allow conversion of 64-bit binaries (b... (Closed)
Left Patch Set: Created 13 years, 9 months ago
Right Patch Set: code review 1702050: strconv.Uitob64: allow conversion of 64-bit binaries (b... Created 13 years, 9 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | src/pkg/strconv/itoa_test.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package strconv 5 package strconv
6 6
7 // Uitob64 returns the string representation of i in the given base. 7 // Uitob64 returns the string representation of i in the given base.
8 func Uitob64(u uint64, base uint) string { 8 func Uitob64(u uint64, base uint) string {
9 if base < 2 || 36 < base { 9 if base < 2 || 36 < base {
10 » » panic("invalid base" + Uitoa(base)) 10 » » panic("invalid base " + Uitoa(base))
11 } 11 }
12 if u == 0 { 12 if u == 0 {
13 return "0" 13 return "0"
14 } 14 }
15 15
16 // Assemble decimal in reverse order. 16 // Assemble decimal in reverse order.
17 var buf [64]byte 17 var buf [64]byte
18 j := len(buf) 18 j := len(buf)
19 b := uint64(base) 19 b := uint64(base)
20 for u > 0 { 20 for u > 0 {
(...skipping 27 matching lines...) Expand all
48 func Uitob(i uint, base uint) string { return Uitob64(uint64(i), base) } 48 func Uitob(i uint, base uint) string { return Uitob64(uint64(i), base) }
49 49
50 // Itob returns the string representation of i in the given base. 50 // Itob returns the string representation of i in the given base.
51 func Itob(i int, base uint) string { return Itob64(int64(i), base) } 51 func Itob(i int, base uint) string { return Itob64(int64(i), base) }
52 52
53 // Itoa returns the decimal string representation of i. 53 // Itoa returns the decimal string representation of i.
54 func Itoa(i int) string { return Itob64(int64(i), 10) } 54 func Itoa(i int) string { return Itob64(int64(i), 10) }
55 55
56 // Uitoa returns the decimal string representation of i. 56 // Uitoa returns the decimal string representation of i.
57 func Uitoa(i uint) string { return Uitob64(uint64(i), 10) } 57 func Uitoa(i uint) string { return Uitob64(uint64(i), 10) }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b