Avoid copying the byte array in crc32() if possible

Signed-off-by: Graham <gpe@openrs2.org>
bzip2
Graham 4 years ago
parent 435a8b4eff
commit 07603d3cfa
  1. 2
      buffer/src/main/kotlin/org/openrs2/buffer/ByteBufExtensions.kt

@ -109,7 +109,7 @@ public fun ByteBuf.crc32(index: Int, len: Int): Int {
} }
} }
count == 1 -> crc.update(nioBuffer(index, len)) count == 1 -> crc.update(nioBuffer(index, len))
else -> crc.update(ByteBufUtil.getBytes(this, index, len)) else -> crc.update(ByteBufUtil.getBytes(this, index, len, false))
} }
return crc.value.toInt() return crc.value.toInt()

Loading…
Cancel
Save