Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fun isBitSet(byte: UInt): Boolean {
- return (byte xor 1u).toUByte() < byte
- }
- fun UByte.getBits(): Array<Boolean> {
- return Array(8) {
- isBitSet(this.toUInt() shr it)
- }
- }
- fun UInt.setBit(bit: Int): UByte = this.or(1u shl bit).toUByte()
Advertisement
Add Comment
Please, Sign In to add comment