package headers // ByteHelper provides helping functions to less-fun-types type SingleByteType interface { bool | ~uint8 } type BoolType interface { bool } func ByteToBool(Input byte) bool { if byte(1) == Input { return true } return false } // ToSingleByte converts single-byte types, such as int8 and bool to single bytes. func ToSingleByte[T SingleByteType](input T) byte { switch input := any(input).(type) { case uint8: return byte(input) case int8: return byte(input) case bool: if input { return byte(1) } else { return byte(0) } default: return byte(-0) } }