Skip to content

Commit

Permalink
Fix compiler warning
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulStoffregen committed Sep 17, 2022
1 parent 84e2b23 commit 9d2cf96
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/MahonyAHRS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,10 @@ void Mahony::updateIMU(float gx, float gy, float gz, float ax, float ay, float a
float Mahony::invSqrt(float x)
{
float halfx = 0.5f * x;
float y = x;
long i = *(long*)&y;
i = 0x5f3759df - (i>>1);
y = *(float*)&i;
union { float f; long l; } i;
i.f = x;
i.l = 0x5f3759df - (i.l >> 1);
float y = i.f;
y = y * (1.5f - (halfx * y * y));
y = y * (1.5f - (halfx * y * y));
return y;
Expand Down

0 comments on commit 9d2cf96

Please sign in to comment.