Last active
November 14, 2017 16:45
-
-
Save elect86/8c0708b113778450eda9eae2d23bdc47 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Ref { | |
var iPtr = 0 | |
var fPtr = 0 | |
var bPtr = 0 | |
val ints = IntArray(100) | |
val floats = FloatArray(100) | |
val bools = BooleanArray(100) | |
var int | |
get() = ints[iPtr] | |
set(value) { ints[iPtr] = value } | |
} | |
inline fun withInt(block: (KMutableProperty0<Int>) -> Unit) { | |
Ref.iPtr++ | |
block(Ref::int) | |
Ref.iPtr-- | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment