You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
246 B
Go
18 lines
246 B
Go
9 years ago
|
package datatypes
|
||
|
|
||
|
// A bit is high or low, 0 or 1, true or false.
|
||
|
type Bit bool
|
||
|
|
||
|
// Int returns the bit value as 0 or 1
|
||
|
func (b Bit) Int() int {
|
||
|
if b {
|
||
|
return 1
|
||
|
} else {
|
||
|
return 0
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func (b Bit) UInt8() uint8 {
|
||
|
return uint8(b.Int())
|
||
|
}
|