1
0
mirror of https://github.com/golang/go synced 2024-11-22 10:54:46 -07:00

binary: remove unnecessary dummy type.

R=rsc
CC=golang-dev
https://golang.org/cl/5698052
This commit is contained in:
Stefan Nilsson 2012-02-23 15:29:17 -05:00 committed by Russ Cox
parent 999c77d78a
commit 83b5f067e8

View File

@ -29,17 +29,13 @@ type ByteOrder interface {
String() string
}
// This is byte instead of struct{} so that it can be compared,
// allowing, e.g., order == binary.LittleEndian.
type unused byte
// LittleEndian is the little-endian implementation of ByteOrder.
var LittleEndian littleEndian
// BigEndian is the big-endian implementation of ByteOrder.
var BigEndian bigEndian
type littleEndian unused
type littleEndian struct{}
func (littleEndian) Uint16(b []byte) uint16 { return uint16(b[0]) | uint16(b[1])<<8 }
@ -79,7 +75,7 @@ func (littleEndian) String() string { return "LittleEndian" }
func (littleEndian) GoString() string { return "binary.LittleEndian" }
type bigEndian unused
type bigEndian struct{}
func (bigEndian) Uint16(b []byte) uint16 { return uint16(b[1]) | uint16(b[0])<<8 }