I may be wrong, but isn't this equivalent?

while(x) { int n = (v > 0 ? 1 : -1); x += n; y += (x - n); z += (y - n); if(doA()) doB(); }Very hard to be sure without understanding what this does.

Doesn't seem equivalent to me. Firstly, x is never stated to have to reach 0. E.g. if v is positive and x is positive, nothing should happen (in the original code).

Additionally, the x, y and z things also seem wrong. I got this for the stuff inside the while loops:

int n = (x < 0) ? 1 : -1; y += x; z += y + n; x += n;

I rejigged the order the variables are adjusted, so if the order is important in the actual code (it isn't in the posted snippet), then this wouldn't work.