MCPcopy
hub / github.com/inbug-team/InScan / IntToBytes

Function IntToBytes

generate_exec/generate_exec.go:35–43  ·  view source on GitHub ↗
(i int)

Source from the content-addressed store, hash-verified

33}
34
35func IntToBytes(i int) []byte {
36 buf := make([]byte, 4)
37 if runtime.GOOS == "windows" {
38 binary.LittleEndian.PutUint32(buf, uint32(i))
39 } else {
40 binary.BigEndian.PutUint32(buf, uint32(i))
41 }
42 return buf
43}
44
45func BytesToInt(buf []byte) int {
46 return int(binary.BigEndian.Uint32(buf))

Callers 1

AppendExecFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected