ursus
01/17/2019, 5:22 PMbytes[0].toInt() shl 24 or (bytes[1].toInt() and 0xFF shl 16) or (bytes[2].toInt() and 0xFF shl 8) or (bytes[3].toInt() and 0xFF);
any sane person would write it alteast as
fun byteArrayToInt(bytes: ByteArray): Int {
return bytes[0].toInt() shl 24
or (bytes[1].toInt() and 0xFF shl 16)
or (bytes[2].toInt() and 0xFF shl 8)
or (bytes[3].toInt() and 0xFF);
}
Shawn
01/17/2019, 5:24 PMfun byteArrayToInt(bytes: ByteArray): Int {
return bytes[0].toInt() shl 24 or
(bytes[1].toInt() and 0xFF shl 16) or
(bytes[2].toInt() and 0xFF shl 8) or
(bytes[3].toInt() and 0xFF)
}
fun byteArrayToInt(bytes: ByteArray): Int {
return (bytes[0].toInt() shl 24
or (bytes[1].toInt() and 0xFF shl 16)
or (bytes[2].toInt() and 0xFF shl 8)
or (bytes[3].toInt() and 0xFF))
}
ursus
01/17/2019, 5:25 PMShawn
01/17/2019, 5:26 PMbytes[0].toInt() shl 24
is a complete statement and the compiler doesn’t know not to interpret a SEMI
afterursus
01/17/2019, 5:26 PM