Skip to content

Instantly share code, notes, and snippets.

@DouglasSherk
Created April 16, 2017 18:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DouglasSherk/2a20e889a5c17c23a24ee177113eb32e to your computer and use it in GitHub Desktop.
Save DouglasSherk/2a20e889a5c17c23a24ee177113eb32e to your computer and use it in GitHub Desktop.
Temporary fix for ArrayX `clear()` function
/**
* Use this in place of `array_get_int()` as the former mishandles
* parameters and needs to be wrapped safely.
*/
stock array_get_int_safe(array, index) {
// Insert a dummy canary into the stack.
new dummy[32]
// Call a native (VM function) using the dummy variable to get
// rid of "unused symbol" warnings.
// (Note: I could have also disabled the compiler warning for
// just this line, but that's not what I did back then.)
float(dummy[0])
// This call will smash `temp`.
return array_get_int(array, index)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment