signed short Py; signed short proj = 0; unsigned short z; for (z = NBDIR; z--; ) { Py = (dy * CosTable[z] + dx * SinTable[z]); if (proj < Py) { proj = Py; angle = z; } }