gsala
05/27/2020, 7:12 AMval impulseDownAllowed: Boolean = capabilitiesByte and 0x10.toByte() != 0.toByte()
val bleMovementAllowed: Boolean = capabilitiesByte and 0x20.toByte() != 0.toByte()
elect
05/27/2020, 7:25 AMval impulseDownAllowed: Boolean = capabilitiesByte has 0x10
val bleMovementAllowed: Boolean = capabilitiesByte has 0x20
elect
05/27/2020, 7:26 AMin
operator, but this requires operands invertedgsala
05/27/2020, 7:27 AMhas
your own infix extension function ?elect
05/27/2020, 7:27 AMelect
05/27/2020, 7:27 AMhasnt
gsala
05/27/2020, 7:29 AMelect
05/27/2020, 7:31 AMelect
05/27/2020, 7:32 AMgsala
05/27/2020, 7:34 AMtoByte()
call to be honest.elect
05/27/2020, 7:34 AM.b
extension for that 😛gsala
05/27/2020, 8:39 AMgsala
05/27/2020, 9:56 AM0x10110110
and the spec says Memory size: Bit 0-2
I want to do something like byte.get(0..2) = 0b101
what would you call such a function?
My best call right now is just fun Byte.get(bitRange : IntRange) : Byte
elect
05/27/2020, 9:58 AMelect
05/27/2020, 9:58 AMbyte[0, 2]
elect
05/27/2020, 9:59 AMgsala
05/27/2020, 11:54 AMelect
05/27/2020, 12:13 PMBytes
and Shorts
) to Int
(or Long
when needed) to perform arithmetic operations, you should consider returning thatelizarov
05/29/2020, 9:02 AM