| 152 | } |
| 153 | |
| 154 | static __inline__ uint16_t palette_from_fixed(Fixed x) { |
| 155 | if (x < 0) x = -x; |
| 156 | if (x >= FIXED_ONE) x = FIXED_ONE - 1; |
| 157 | int idx = FIXED_FRAC(x) >> (FIXED_BITS - PALETTE_BITS); |
| 158 | return palette[idx & (PALETTE_SIZE - 1)]; |
| 159 | } |
| 160 | |
| 161 | /* Angles expressed as fixed point radians */ |
| 162 |