@@ -5,10 +5,10 @@ import at.petrak.hexcasting.api.casting.eval.CastingEnvironment
55import at.petrak.hexcasting.api.casting.eval.OperationResult
66import at.petrak.hexcasting.api.casting.eval.vm.CastingImage
77import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation
8- import at.petrak.hexcasting.api.casting.getPositiveInt
8+ import at.petrak.hexcasting.api.casting.getPositiveLong
99import at.petrak.hexcasting.api.casting.mishaps.MishapNotEnoughArgs
1010import at.petrak.hexcasting.common.lib.hex.HexEvalSounds
11- import it.unimi.dsi.fastutil.ints.IntArrayList
11+ import it.unimi.dsi.fastutil.longs.LongArrayList
1212
1313// "lehmer code"
1414object OpAlwinfyHasAscendedToABeingOfPureMath : Action {
@@ -18,10 +18,10 @@ object OpAlwinfyHasAscendedToABeingOfPureMath : Action {
1818 if (stack.isEmpty())
1919 throw MishapNotEnoughArgs (1 , 0 )
2020
21- val code = stack.getPositiveInt (stack.lastIndex)
21+ val code = stack.getPositiveLong (stack.lastIndex)
2222 stack.removeLast()
2323
24- val strides = IntArrayList ()
24+ val strides = LongArrayList ()
2525 for (f in FactorialIter ()) {
2626 if (f <= code)
2727 strides.add(f)
@@ -37,7 +37,7 @@ object OpAlwinfyHasAscendedToABeingOfPureMath : Action {
3737 for (divisor in strides.asReversed()) {
3838 val index = radix / divisor
3939 radix % = divisor
40- editTarget[0 ] = swap.removeAt(index)
40+ editTarget[0 ] = swap.removeAt(index.toInt() )
4141 // i hope this isn't O(n)
4242 editTarget = editTarget.subList(1 , editTarget.size)
4343 }
@@ -46,12 +46,12 @@ object OpAlwinfyHasAscendedToABeingOfPureMath : Action {
4646 return OperationResult (image2, listOf (), continuation, HexEvalSounds .NORMAL_EXECUTE )
4747 }
4848
49- private class FactorialIter : Iterator <Int > {
50- var acc = 1
51- var n = 1
49+ private class FactorialIter : Iterator <Long > {
50+ var acc = 1L
51+ var n = 1L
5252 override fun hasNext (): Boolean = true
5353
54- override fun next (): Int {
54+ override fun next (): Long {
5555 val out = this .acc
5656 this .acc * = this .n
5757 this .n++
0 commit comments