Philip Dukhov
01/13/2021, 1:17 AMIntByteArray.toByte()usePinnedtravis
01/13/2021, 1:23 AMLongByteArrayprivate fun Long.toByteArray(): ByteArray {
    val data = ByteArray(8)
    var i = 0
    data[i++] = (this ushr 56 and 0xffL).toByte()
    data[i++] = (this ushr 48 and 0xffL).toByte()
    data[i++] = (this ushr 40 and 0xffL).toByte()
    data[i++] = (this ushr 32 and 0xffL).toByte()
    data[i++] = (this ushr 24 and 0xffL).toByte()
    data[i++] = (this ushr 16 and 0xffL).toByte()
    data[i++] = (this ushr  8 and 0xffL).toByte() // ktlint-disable no-multi-spaces
    data[i]   = (this         and 0xffL).toByte() // ktlint-disable no-multi-spaces
    return data
}Philip Dukhov
01/13/2021, 2:20 AM