MiniGUI API Reference (MiniGUI-Threads)
v5.0.6
A mature and proven cross-platform GUI system for embedded and smart IoT devices
|
Go to the documentation of this file.
67 #ifndef _MGUI_MGHAVE_FIXED_MATH_H
68 #define _MGUI_MGHAVE_FIXED_MATH_H
80 #ifdef _MGHAVE_FIXED_MATH
166 extern MG_EXPORT
const fixed __mg_cos_tbl[];
167 extern MG_EXPORT
const fixed __mg_tan_tbl[];
168 extern MG_EXPORT
const fixed __mg_acos_tbl[];
197 return (
long)(x * 65536.0 + (x < 0 ? -0.5 : 0.5));
211 return (
double)x / 65536.0;
231 fixed result = x + y;
234 if ((x < 0) && (y < 0)) {
242 if ((x > 0) && (y > 0)) {
268 fixed result = x - y;
271 if ((x < 0) && (y > 0)) {
279 if ((x > 0) && (y < 0)) {
330 if (x > 0x7FFF0000) {
339 return ~((~x) >> 16);
365 return (x >> 16) + ((x & 0x8000) >> 15);
379 return __mg_cos_tbl[((x + 0x4000) >> 15) & 0x1FF];
393 return __mg_cos_tbl[((x - 0x400000 + 0x4000) >> 15) & 0x1FF];
407 return __mg_tan_tbl[((x + 0x4000) >> 15) & 0xFF];
425 if ((x < -65536) || (x > 65536)) {
430 return __mg_acos_tbl[(x+65536+127)>>8];
448 if ((x < -65536) || (x > 65536)) {
453 return 0x00400000 - __mg_acos_tbl[(x+65536+127)>>8];
long fixed
Data type of fixed point.
MG_EXPORT fixed fixdiv(fixed x, fixed y)
Returns the quotient of two fixed point values.
static int fixtoi(fixed x)
Converts an fixed point value to an integer.
MG_EXPORT fixed fixatan(fixed x)
Calculates the arc tangent of a fixed point value.
static fixed fixcos(fixed x)
Returns the cosine of a fixed point.
static fixed fixsin(fixed x)
Returns the sine of a fixed point.
static double fixtof(fixed x)
Converts a fixed point value to a float point value.
static fixed itofix(int x)
Converts an integer to a fixed point value.
static fixed fixadd(fixed x, fixed y)
Returns the sum of two fixed point values.
MG_EXPORT fixed fixmul(fixed x, fixed y)
Returns the product of two fixed point values.
static fixed fixacos(fixed x)
Calculates and returns the arc cosine of a fixed point.
static fixed fixsub(fixed x, fixed y)
Subtract a fixed point value from another.
MG_EXPORT fixed fixatan2(fixed y, fixed x)
Calculates the arc tangent of two fixed point variables.
static fixed fixasin(fixed x)
Calculates and returns the arc sine of a fixed point.
MG_EXPORT fixed fixhypot(fixed x, fixed y)
Returns the Euclidean distance from the origin.
MG_EXPORT fixed fixsqrt(fixed x)
Returns the non-negative square root of a fixed point value.
static int fixceil(fixed x)
Rounds a fixed point value to the nearest integer.
static fixed ftofix(double x)
Converts a float point value to a fixed point value.
static fixed fixtan(fixed x)
Returns the tangent of a fixed point.