1 package bytewrite // import "vimagination.zapto.org/bytewrite" 2 3 var ( 4 // BigEndian implementinterface Endian 5 BigEndian bigEndian 6 // LittleEndian implementinterface Endian 7 LittleEndian littleEndian 8 _ Endian = BigEndian 9 _ Endian = LittleEndian 10 ) 11 12 // Endian represents the numerous methds available for easy endian conversion 13 type Endian interface { 14 // Takes a slice of bytes and returns a float32 oriented according to the endianness 15 Float32(b []byte) float32 16 // Takes a float32 and returns a slice of bytes, ordered according to the endianness 17 PutFloat32(f float32) []byte 18 // Takes a slice of bytes and returns a float64 oriented according to the endianness 19 Float64(b []byte) float64 20 // Takes a float64 and returns a slice of bytes, ordered according to the endianness 21 PutFloat64(f float64) []byte 22 // Takes a slice of bytes and returns a uint16 oriented according to the endianness 23 Uint16(b []byte) uint16 24 // Takes a uint16 and returns a slice of bytes, ordered according to the endianness 25 PutUint16(v uint16) []byte 26 // Takes a slice of bytes and returns a uint32 oriented according to the endianness 27 Uint32(b []byte) uint32 28 // Takes a uint32 and returns a slice of bytes, ordered according to the endianness 29 PutUint32(v uint32) []byte 30 // Takes a slice of bytes and returns a uint64 oriented according to the endianness 31 Uint64(b []byte) uint64 32 // Takes a uint64 and returns a slice of bytes, ordered according to the endianness 33 PutUint64(v uint64) []byte 34 }