From bfcb373ade5f490cb4c5aa47d222eb7fb3d033ec Mon Sep 17 00:00:00 2001 From: Graham Date: Sat, 29 Feb 2020 22:04:21 +0000 Subject: [PATCH] Add ClassVersionUtils --- .../java/dev/openrs2/asm/ClassVersionUtils.kt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 asm/src/main/java/dev/openrs2/asm/ClassVersionUtils.kt diff --git a/asm/src/main/java/dev/openrs2/asm/ClassVersionUtils.kt b/asm/src/main/java/dev/openrs2/asm/ClassVersionUtils.kt new file mode 100644 index 0000000000..76d4c37908 --- /dev/null +++ b/asm/src/main/java/dev/openrs2/asm/ClassVersionUtils.kt @@ -0,0 +1,15 @@ +package dev.openrs2.asm + +object ClassVersionUtils { + private fun swapWords(v: Int): Int { + return (v shl 16) or (v ushr 16) + } + + fun maxVersion(v1: Int, v2: Int): Int { + return if (swapWords(v1) > swapWords(v2)) { + v1 + } else { + v2 + } + } +}