New pointer syntax
BlitzMax Forums/BlitzMax Programming/New pointer syntax
| ||
What's the equivalent code using the new pointer syntax?Local centre_ptr:Int Ptr centre_ptr = centre_sqr ' pointer to centre square array For Local square:Int = 1 To 64 nearest_sqr = Var(centre_ptr) x = Var(centre_ptr+1) + board_x ; y = Var(centre_ptr+2) + board_y ' etc centre_ptr :+ 3 Next |
| ||
This is I thinkLocal centre_ptr:Int Ptr centre_ptr = centre_sqr ' pointer to centre square array For Local square:Int = 1 To 64 nearest_sqr = centre_ptr[0] x = centre_ptr[1] + board_x ; y = centre_ptr[2] + board_y ' etc centre_ptr :+ 3 Next |
| ||
That doesn't seem to work Azathoth - but I use pointers throughout my program so it might be another routine that also needs to be modified. |
| ||
Is 'Var(centre_ptr+1)' using an offset of 1 byte or 1 int (4 bytes)? If its 1 byte you might have to cast it to a byte pointer or use banks. |
| ||
Int...Local centre_ptr:Int Ptr |