| 221 | } |
| 222 | |
| 223 | int32_t integerSinePrecisionHigh(uint16_t direction, int32_t magnitude) |
| 224 | { |
| 225 | // Build the full sine wave from the quarter wave by subtraction of direction/magnitude |
| 226 | // Note: ~ bitwise negation important for both to match vanilla |
| 227 | const auto sineIndex = ((direction & (1 << 12)) ? ~direction : direction) & 0xFFF; |
| 228 | const auto value = (direction & (1 << 13)) ? ~Data::kQuarterSine[sineIndex] : Data::kQuarterSine[sineIndex]; |
| 229 | return value * magnitude / 0x8000; |
| 230 | } |
| 231 | |
| 232 | int32_t integerCosinePrecisionHigh(uint16_t direction, int32_t magnitude) |
| 233 | { |
no outgoing calls