Sylvain Patenaude
12/03/2019, 8:55 PMByte
or UByte
literal? I know that val toto: UByte = 128u
works when it's an assignment, but I'm looking to make something like this compile:
while (myUByteArray[index] and 128u == 128u) {
}
without having to do an explicit cast like 128u.toUByte()
.
Thanks!
EDIT: According to https://kotlinlang.org/docs/tutorials/kotlin-for-py/primitive-data-types-and-their-limitations.html, I can't without an explicit conversion. I think I will just put the 128u
into a local val
.Dico
12/04/2019, 7:37 AMmyUByteArray[index].toUInt()
And compare with 0x80u
Are you trying to read a varint? :)Sylvain Patenaude
12/04/2019, 2:10 PM