Skip to content

Instantly share code, notes, and snippets.

@elect86
Last active November 14, 2017 16:45
Show Gist options
  • Save elect86/8c0708b113778450eda9eae2d23bdc47 to your computer and use it in GitHub Desktop.
Save elect86/8c0708b113778450eda9eae2d23bdc47 to your computer and use it in GitHub Desktop.
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