aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/BitManipulation.kt
diff options
context:
space:
mode:
authorJames Barnett <noreply@jamesbarnett.xyz>2018-07-16 21:27:33 +0100
committerJames Barnett <noreply@jamesbarnett.xyz>2018-07-16 21:27:33 +0100
commitae3bb9819aad653d6a2ed972000e3c3696e39bf1 (patch)
tree38cf07fc92c728807f03603ac0b0f7c51df77115 /src/main/kotlin/BitManipulation.kt
parent244cf2663133abb2fb861bce0474344999652f67 (diff)
downloadKGB-ae3bb9819aad653d6a2ed972000e3c3696e39bf1.tar.xz
KGB-ae3bb9819aad653d6a2ed972000e3c3696e39bf1.zip
Implement JUMP ops
Diffstat (limited to 'src/main/kotlin/BitManipulation.kt')
-rw-r--r--src/main/kotlin/BitManipulation.kt4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/main/kotlin/BitManipulation.kt b/src/main/kotlin/BitManipulation.kt
index b655718..430d840 100644
--- a/src/main/kotlin/BitManipulation.kt
+++ b/src/main/kotlin/BitManipulation.kt
@@ -28,12 +28,12 @@ object BitManipulation {
}
}
- fun isSignedBitNegative(value: Int): Boolean {
+ fun isSignedByteNegative(value: Int): Boolean {
return value and (1 shl 7) != 0
}
fun getAbsoluteValue(value: Int ): Int{
- return if(isSignedBitNegative(value)) {
+ return if(isSignedByteNegative(value)) {
0x0100 - value // 1 00000000 - 1xxxxxx = value, due to 2s compliment
} else {
value