Skip to content

Commit

Permalink
working on color addons
Browse files Browse the repository at this point in the history
  • Loading branch information
kdschlosser committed May 5, 2024
1 parent c1ee07f commit a49f27b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions ext_mod/lvgl_addons/src/color_addons.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#define INV_TWO_PI 0.15915494309189533576876437577476f

#ifdef MP_SOFT_ATAN2

// Approximates atan2(y, x) normalized to the [0,4) range
// with a maximum error of 0.1620 degrees
float soft_atan2( float y, float x )
Expand All @@ -18,8 +17,8 @@ float soft_atan2( float y, float x )
static const float b = 0.596227f;

// Extract the sign bits
uint32_t ux_s = sign_mask & ((uint32_t) &)x;
uint32_t uy_s = sign_mask & ((uint32_t) &)y;
uint32_t ux_s = sign_mask & (uint32_t)x;
uint32_t uy_s = sign_mask & (uint32_t)y;

// Determine the quadrant offset
float q = (float)( ( ~ux_s & uy_s ) >> 29 | ux_s >> 30 );
Expand All @@ -30,8 +29,8 @@ float soft_atan2( float y, float x )
float atan_1q = num / ( x * x + bxy_a + num );

// Translate it to the proper quadrant
uint32_t uatan_2q = (ux_s ^ uy_s) | ((uint32_t) &)atan_1q;
return q + ((float) &)uatan_2q;
uint32_t uatan_2q = (ux_s ^ uy_s) | (uint32_t)atan_1q;
return q + (float)uatan_2q;
}

#endif /* MP_SOFT_ATAN */
Expand Down

0 comments on commit a49f27b

Please sign in to comment.