I have a ByteBuffer reading a binary file with val...
# announcements
b
I have a ByteBuffer reading a binary file with values as UInt32 . How do I read that in kotlin?
in java people do bb.getInt() & 0xFFFFFFFFL
but that doesn't work in kotlin (wants both sides to be of the same type)
I also can't do that with bytes:
(in java) (((b[3] & 0xff) << 24) | ((b[2] & 0xff) << 16) | ((b[1] & 0xff) << 8) | (b[0] & 0xff));
s
and
alternatively, do
getInt
and convert it to a
UInt
, then & it with the constant (also as an unsigned int)
b
of 0xffu is a thing now as well