mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/link,compress/zip,image/png: use binary.{Big,Little}Endian methods
Use the binary.{Big,Little}Endian integer encoding methods rather than
variations found in local implementations. The functions in
the binary package have been tested to ensure they inline correctly and
don't add unnecessary bounds checking.
Change-Id: Ie10111ca6edb7c11e8e5e21c58a5748ae99b7f87
Reviewed-on: https://go-review.googlesource.com/134375
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Munday <mike.munday@ibm.com>
This commit is contained in:
parent
9f2411894b
commit
aa4fc0e736
4 changed files with 14 additions and 47 deletions
|
|
@ -1757,26 +1757,6 @@ func addsection(arch *sys.Arch, seg *sym.Segment, name string, rwx int) *sym.Sec
|
|||
return sect
|
||||
}
|
||||
|
||||
func Le16(b []byte) uint16 {
|
||||
return uint16(b[0]) | uint16(b[1])<<8
|
||||
}
|
||||
|
||||
func Le32(b []byte) uint32 {
|
||||
return uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24
|
||||
}
|
||||
|
||||
func Le64(b []byte) uint64 {
|
||||
return uint64(Le32(b)) | uint64(Le32(b[4:]))<<32
|
||||
}
|
||||
|
||||
func Be16(b []byte) uint16 {
|
||||
return uint16(b[0])<<8 | uint16(b[1])
|
||||
}
|
||||
|
||||
func Be32(b []byte) uint32 {
|
||||
return uint32(b[0])<<24 | uint32(b[1])<<16 | uint32(b[2])<<8 | uint32(b[3])
|
||||
}
|
||||
|
||||
type chain struct {
|
||||
sym *sym.Symbol
|
||||
up *chain
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue