mohamed rejeb
08/09/2023, 5:57 PM#define test 'test'
mohamed rejeb
08/10/2023, 10:28 AMval charList = listOf('t', 'e', 's', 't')
val code = (charList[0].toInt() shl 24) or
(charList[1].toInt() shl 16) or
(charList[2].toInt() shl 8) or
charList[3].toInt()
Miroslav Sobotka
08/10/2023, 2:31 PMfun String.asFourCharCode(): UInt {
require(length == 4) { "Code length must be 4 characters" }
var hash: UInt = 0u
for (char in this) {
hash = (hash shl 8) or char.code.toUInt()
}
return hash
}