github.com/GeniusesGroup/libgo@v0.0.0-20220929090155-5ff932cb408e/binary/binary.go (about)

     1  // For license and copyright information please see the LEGAL file in the code repository
     2  
     3  package binary
     4  
     5  func Bool(b []byte) bool   { return b[0] != 0 }
     6  func Uint8(b []byte) uint8 { return uint8(b[0]) }
     7  
     8  func PutBool(b []byte, v bool) {
     9  	if v {
    10  		b[0] = 1
    11  	} else {
    12  		b[0] = 0
    13  	}
    14  }
    15  func PutUint8(b []byte, v uint8) {
    16  	b[0] = v
    17  }