Created
April 16, 2017 18:48
-
-
Save DouglasSherk/2a20e889a5c17c23a24ee177113eb32e to your computer and use it in GitHub Desktop.
Temporary fix for ArrayX `clear()` function
This file contains hidden or 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
/** | |
* 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