This rot
is not a standard function. Rather it is part of the code which you are translating. You simply need to keep reading the article to which you link. A few lines on you will find this:
//rotate/flip a quadrant appropriately
void rot(int n, int *x, int *y, int rx, int ry) {
if (ry == 0) {
if (rx == 1) {
*x = n-1 - *x;
*y = n-1 - *y;
}
//Swap x and y
int t = *x;
*x = *y;
*y = t;
}
}
You need to translate this function alongside the code in your question. I'm sure you don't need me to do the translation of such a simple function.
I would say though that rx
and ry
are really booleans and you may be better coding them that way. The code in the article is written in a C flavour that pre-dates C boolean types. That said, the function in the question performs arithmetic on these "booleans" so it's a little tricky to write a clean literal translation.
The parameters passed as pointers are probably better as var
parameters and so passed by reference. Again a feature that C lacks.