Do you know if a floatToRawIntBits can be performed faster than a float->int cast? I might try comparing them at some point, but if it can be then:
1 2 3
| public static float sin(float phase){ return TABLE[(Float.floatToRawIntBits(1.0f+f) >> 15) & 0xFF]; } |
for a 256 length table. For 512 then shift by 14, and mask with 0x1FF, etc. The idea being to keep the float within one power-of-two fraction, and just use the most significant mantissa bits.
This assumes that the range is from 0-1.0f, excluding 1.0f.
Edit: This isn't actually answering the original question, sorry. Just a thought of an alternative to the float cast.