1
- package io.github.charlietap.chasm.executor.runtime.ext
1
+ package io.github.charlietap.chasm.executor.runtime
2
2
3
3
import com.github.michaelbull.result.Err
4
4
import com.github.michaelbull.result.Ok
5
- import io.github.charlietap.chasm.executor.runtime.Stack
6
5
import io.github.charlietap.chasm.executor.runtime.error.InvocationError
6
+ import io.github.charlietap.chasm.executor.runtime.ext.binaryOperation
7
+ import io.github.charlietap.chasm.executor.runtime.ext.constOperation
8
+ import io.github.charlietap.chasm.executor.runtime.ext.convertOperation
9
+ import io.github.charlietap.chasm.executor.runtime.ext.pushFrame
10
+ import io.github.charlietap.chasm.executor.runtime.ext.relationalOperation
11
+ import io.github.charlietap.chasm.executor.runtime.ext.testOperation
12
+ import io.github.charlietap.chasm.executor.runtime.ext.unaryOperation
7
13
import io.github.charlietap.chasm.executor.runtime.instruction.AdminInstruction
8
14
import io.github.charlietap.chasm.executor.runtime.value.NumberValue.F32
9
15
import io.github.charlietap.chasm.executor.runtime.value.NumberValue.F64
@@ -12,30 +18,9 @@ import io.github.charlietap.chasm.executor.runtime.value.NumberValue.I64
12
18
import io.github.charlietap.chasm.fixture.frame
13
19
import io.github.charlietap.chasm.fixture.instruction
14
20
import io.github.charlietap.chasm.fixture.stack
15
- import kotlin.math.sqrt
16
21
import kotlin.test.Test
17
22
import kotlin.test.assertEquals
18
23
19
- private fun Int.eq (other : Int ): Boolean = this == other
20
-
21
- private fun Long.eq (other : Long ): Boolean = this == other
22
-
23
- private fun Float.eq (other : Float ): Boolean = this == other
24
-
25
- private fun Double.eq (other : Double ): Boolean = this == other
26
-
27
- private fun Int.eqz (): Boolean = this == 0
28
-
29
- private fun Long.eqz (): Boolean = this == 0L
30
-
31
- private fun Long.countTrailingZero (): Long = countTrailingZeroBits().toLong()
32
-
33
- private fun Long.wrap (): Int = this .toInt()
34
-
35
- private fun Float.sqrt (): Float = sqrt(this )
36
-
37
- private fun Double.sqrt (): Double = sqrt(this )
38
-
39
24
class StackExtTest {
40
25
41
26
@Test
@@ -370,3 +355,23 @@ class StackExtTest {
370
355
assertEquals(Stack .MAX_DEPTH , stack.size())
371
356
}
372
357
}
358
+
359
+ private fun Int.eq (other : Int ): Boolean = this == other
360
+
361
+ private fun Long.eq (other : Long ): Boolean = this == other
362
+
363
+ private fun Float.eq (other : Float ): Boolean = this == other
364
+
365
+ private fun Double.eq (other : Double ): Boolean = this == other
366
+
367
+ private fun Int.eqz (): Boolean = this == 0
368
+
369
+ private fun Long.eqz (): Boolean = this == 0L
370
+
371
+ private fun Long.countTrailingZero (): Long = countTrailingZeroBits().toLong()
372
+
373
+ private fun Long.wrap (): Int = this .toInt()
374
+
375
+ private fun Float.sqrt (): Float = kotlin.math.sqrt(this )
376
+
377
+ private fun Double.sqrt (): Double = kotlin.math.sqrt(this )
0 commit comments