fmt and reflect updates for recent changes

TBR=r
OCL=21580
CL=21583
This commit is contained in:
Russ Cox 2008-12-19 03:06:19 -08:00
parent dc7b2e98d2
commit ba882f9940
7 changed files with 58 additions and 59 deletions

View file

@ -27,12 +27,13 @@ type FmtTest struct {
}
// TODO(rsc): return []byte, but need to be able to pass as interface.
// func Bytes(s string) []byte {
// b := new([]byte, len(s)+1);
// syscall.StringToBytes(b, s);
// return b[0:len(s)];
// }
func Bytes(s string) string { return s }
func Bytes(s string) *[]byte {
b := new([]byte, len(s)+1);
syscall.StringToBytes(b, s);
bp := new(*[]byte);
*bp = b[0:len(s)];
return bp;
}
const B32 uint32 = 1<<32 - 1
const B64 uint64 = 1<<64 - 1