Documentation ¶
Index ¶
- func Float32(endian binary.ByteOrder) parser.Func[byte, float32]
- func Float64(endian binary.ByteOrder) parser.Func[byte, float64]
- func Int16(endian binary.ByteOrder) parser.Func[byte, int16]
- func Int32(endian binary.ByteOrder) parser.Func[byte, int32]
- func Int64(endian binary.ByteOrder) parser.Func[byte, int64]
- func Uint16(endian binary.ByteOrder) parser.Func[byte, uint16]
- func Uint32(endian binary.ByteOrder) parser.Func[byte, uint32]
- func Uint64(endian binary.ByteOrder) parser.Func[byte, uint64]
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Float32 ¶
Float32 reads a float32 out of the byte stream with the specified endianess.
Example ¶
package main import ( "encoding/binary" "fmt" "github.com/flier/gocombine/pkg/parser/bytes/num" ) func main() { p := num.Float32(binary.LittleEndian) fmt.Println(p([]byte{0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF})) }
Output: 1.7378244e+34 [144 171 205 239] <nil>
func Float64 ¶
Float64 reads a float64 out of the byte stream with the specified endianess.
Example ¶
package main import ( "encoding/binary" "fmt" "github.com/flier/gocombine/pkg/parser/bytes/num" ) func main() { p := num.Float64(binary.LittleEndian) fmt.Println(p([]byte{0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF})) }
Output: -3.5987094278483163e+230 [] <nil>
func Int16 ¶
Int16 reads a int16 out of the byte stream with the specified endianess.
Example ¶
package main import ( "encoding/binary" "fmt" "github.com/flier/gocombine/pkg/parser/bytes/num" ) func main() { p := num.Int16(binary.LittleEndian) fmt.Println(p([]byte{0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF})) }
Output: 13330 [86 120 144 171 205 239] <nil>
func Int32 ¶
Int32 reads a int32 out of the byte stream with the specified endianess.
Example ¶
package main import ( "encoding/binary" "fmt" "github.com/flier/gocombine/pkg/parser/bytes/num" ) func main() { p := num.Int32(binary.LittleEndian) fmt.Println(p([]byte{0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF})) }
Output: 2018915346 [144 171 205 239] <nil>
func Int64 ¶
Int64 reads a int64 out of the byte stream with the specified endianess.
Example ¶
package main import ( "encoding/binary" "fmt" "github.com/flier/gocombine/pkg/parser/bytes/num" ) func main() { p := num.Int64(binary.LittleEndian) fmt.Println(p([]byte{0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF})) }
Output: -1167088091436534766 [] <nil>
func Uint16 ¶
Uint16 reads a uint16 out of the byte stream with the specified endianess.
Example ¶
package main import ( "encoding/binary" "fmt" "github.com/flier/gocombine/pkg/parser/bytes/num" ) func main() { p := num.Uint16(binary.LittleEndian) fmt.Println(p([]byte{0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF})) }
Output: 13330 [86 120 144 171 205 239] <nil>
func Uint32 ¶
Uint32 reads a uint32 out of the byte stream with the specified endianess.
Example ¶
package main import ( "encoding/binary" "fmt" "github.com/flier/gocombine/pkg/parser/bytes/num" ) func main() { p := num.Uint32(binary.LittleEndian) fmt.Println(p([]byte{0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF})) }
Output: 2018915346 [144 171 205 239] <nil>
func Uint64 ¶
Uint64 reads a uint64 out of the byte stream with the specified endianess.
Example ¶
package main import ( "encoding/binary" "fmt" "github.com/flier/gocombine/pkg/parser/bytes/num" ) func main() { p := num.Uint64(binary.LittleEndian) fmt.Println(p([]byte{0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF})) }
Output: 17279655982273016850 [] <nil>
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.