Skip to content

Commit e28f0cd

Browse files
author
Richard Unger
committed
change cast to make ESP32 compiler happy
1 parent fb4194b commit e28f0cd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/common/foc_utils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ __attribute__((weak)) float _sqrtApprox(float number) {//low in fat
9292

9393
// x = number * 0.5F;
9494
float y = number;
95-
long i = * ( long * ) &y;
95+
uint32_t i = *reinterpret_cast<uint32_t*>(&y);
9696
i = 0x5f375a86 - ( i >> 1 );
97-
y = * ( float * ) &i;
97+
y = *reinterpret_cast<float*>(&i);
9898
// y = y * ( f - ( x * y * y ) ); // better precision
9999
return number * y;
100100
}

0 commit comments

Comments
 (0)