Commit a3dc8357 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 574554e2
...@@ -29,9 +29,8 @@ package packed ...@@ -29,9 +29,8 @@ package packed
// https://github.com/golang/go/issues/15925 // https://github.com/golang/go/issues/15925
// //
// so in the end we use hand-crafted array-like byte-structs. // so in the end we use hand-crafted array-like byte-structs.
type BE16 struct { _0, _1 byte } type BE16 struct{ _0, _1 byte }
type BE32 struct { _0, _1, _2, _3 byte } type BE32 struct{ _0, _1, _2, _3 byte }
func Ntoh16(v BE16) uint16 { func Ntoh16(v BE16) uint16 {
// XXX not as good as BigEndian.Uint16 // XXX not as good as BigEndian.Uint16
...@@ -40,7 +39,7 @@ func Ntoh16(v BE16) uint16 { ...@@ -40,7 +39,7 @@ func Ntoh16(v BE16) uint16 {
} }
func Hton16(v uint16) BE16 { func Hton16(v uint16) BE16 {
return BE16{byte(v>>8), byte(v)} return BE16{byte(v >> 8), byte(v)}
} }
func Ntoh32(v BE32) uint32 { func Ntoh32(v BE32) uint32 {
...@@ -50,5 +49,5 @@ func Ntoh32(v BE32) uint32 { ...@@ -50,5 +49,5 @@ func Ntoh32(v BE32) uint32 {
} }
func Hton32(v uint32) BE32 { func Hton32(v uint32) BE32 {
return BE32{byte(v>>24), byte(v>>16), byte(v>>8), byte(v)} return BE32{byte(v >> 24), byte(v >> 16), byte(v >> 8), byte(v)}
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment