mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Use std::numbers::pi instead of nonstandard M_PI
This commit is contained in:
@@ -5,10 +5,9 @@
|
|||||||
#include "asm/fixpoint.hpp"
|
#include "asm/fixpoint.hpp"
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include <numbers>
|
||||||
|
|
||||||
#ifndef M_PI
|
static constexpr double tau = std::numbers::pi * 2;
|
||||||
#define M_PI 3.14159265358979323846
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static double fix2double(int32_t i, int32_t q) {
|
static double fix2double(int32_t i, int32_t q) {
|
||||||
return i / pow(2.0, q);
|
return i / pow(2.0, q);
|
||||||
@@ -25,11 +24,11 @@ static int32_t double2fix(double d, int32_t q) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static double turn2rad(double t) {
|
static double turn2rad(double t) {
|
||||||
return t * (M_PI * 2);
|
return t * tau;
|
||||||
}
|
}
|
||||||
|
|
||||||
static double rad2turn(double r) {
|
static double rad2turn(double r) {
|
||||||
return r / (M_PI * 2);
|
return r / tau;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t fix_Sin(int32_t i, int32_t q) {
|
int32_t fix_Sin(int32_t i, int32_t q) {
|
||||||
|
|||||||
Reference in New Issue
Block a user