le

package
v0.0.0-...-1dacd80 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2022 License: Apache-2.0, MIT Imports: 3 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Float32

func Float32() parser.Func[byte, float32]

Float32 reads a float32 out of the byte stream with the little endianess.

Example
package main

import (
	"fmt"

	"github.com/flier/gocombine/pkg/parser/bytes/le"
)

func main() {
	p := le.Float32()

	fmt.Println(p([]byte{0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF}))

}
Output:

1.7378244e+34 [144 171 205 239] <nil>

func Float64

func Float64() parser.Func[byte, float64]

Float64 reads a float64 out of the byte stream with the little endianess.

Example
package main

import (
	"fmt"

	"github.com/flier/gocombine/pkg/parser/bytes/le"
)

func main() {
	p := le.Float64()

	fmt.Println(p([]byte{0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF}))

}
Output:

-3.5987094278483163e+230 [] <nil>

func Int16

func Int16() parser.Func[byte, int16]

Int16 reads a int16 out of the byte stream with the little endianess.

Example
package main

import (
	"fmt"

	"github.com/flier/gocombine/pkg/parser/bytes/le"
)

func main() {
	p := le.Int16()

	fmt.Println(p([]byte{0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF}))

}
Output:

13330 [86 120 144 171 205 239] <nil>

func Int32

func Int32() parser.Func[byte, int32]

Int32 reads a int32 out of the byte stream with the little endianess.

Example
package main

import (
	"fmt"

	"github.com/flier/gocombine/pkg/parser/bytes/le"
)

func main() {
	p := le.Int32()

	fmt.Println(p([]byte{0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF}))

}
Output:

2018915346 [144 171 205 239] <nil>

func Int64

func Int64() parser.Func[byte, int64]

Int64 reads a int64 out of the byte stream with the little endianess.

Example
package main

import (
	"fmt"

	"github.com/flier/gocombine/pkg/parser/bytes/le"
)

func main() {
	p := le.Int64()

	fmt.Println(p([]byte{0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF}))

}
Output:

-1167088091436534766 [] <nil>

func Uint16

func Uint16() parser.Func[byte, uint16]

Uint16 reads a uint16 out of the byte stream with the little endianess.

Example
package main

import (
	"fmt"

	"github.com/flier/gocombine/pkg/parser/bytes/le"
)

func main() {
	p := le.Uint16()

	fmt.Println(p([]byte{0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF}))

}
Output:

13330 [86 120 144 171 205 239] <nil>

func Uint32

func Uint32() parser.Func[byte, uint32]

Uint32 reads a uint32 out of the byte stream with the little endianess.

Example
package main

import (
	"fmt"

	"github.com/flier/gocombine/pkg/parser/bytes/le"
)

func main() {
	p := le.Uint32()

	fmt.Println(p([]byte{0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF}))

}
Output:

2018915346 [144 171 205 239] <nil>

func Uint64

func Uint64() parser.Func[byte, uint64]

Uint64 reads a uint64 out of the byte stream with the little endianess.

Example
package main

import (
	"fmt"

	"github.com/flier/gocombine/pkg/parser/bytes/le"
)

func main() {
	p := le.Uint64()

	fmt.Println(p([]byte{0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF}))

}
Output:

17279655982273016850 [] <nil>

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL