I need to compute the direction of 2D vectors that are provided as a pair of 16 bit signed integers, and return an integer in range $[0,256)$.
This can be achieved by the expression
$$\frac{128}\pi\text{atan}_2(y, x)+ 128$$
or alternatively
$$\frac{128}\pi\arctan\frac yx\stackrel?+128$$ with extra logics to adjust the quadrant.
Given the relatively low accuracy requirement, I hope to find fast approximation. The goal is of course to outperform the above expressions when computed by the FPU (assuming a PC architecture).
You could make use of an existing implementation and map it to your needs: