add const to _cos_tbl, _tag_tbl, and _acos_tbl; add prefix __mg to these global variables

This commit is contained in:
Vincent Wei
2019-03-07 18:46:42 +08:00
parent d1ef9e2598
commit 7e0b378475
2 changed files with 12 additions and 12 deletions

View File

@@ -151,9 +151,9 @@ MG_EXPORT fixed fixatan (fixed x);
*/
MG_EXPORT fixed fixatan2 (fixed y, fixed x);
extern MG_EXPORT fixed _cos_tbl[];
extern MG_EXPORT fixed _tan_tbl[];
extern MG_EXPORT fixed _acos_tbl[];
extern MG_EXPORT const fixed __mg_cos_tbl[];
extern MG_EXPORT const fixed __mg_tan_tbl[];
extern MG_EXPORT const fixed __mg_acos_tbl[];
/************************** inline fixed point math functions *****************/
/* ftofix and fixtof are used in generic C versions of fixmul and fixdiv */
@@ -364,7 +364,7 @@ static inline int fixtoi (fixed x)
*/
static inline fixed fixcos (fixed x)
{
return _cos_tbl[((x + 0x4000) >> 15) & 0x1FF];
return __mg_cos_tbl[((x + 0x4000) >> 15) & 0x1FF];
}
/**
@@ -378,7 +378,7 @@ static inline fixed fixcos (fixed x)
*/
static inline fixed fixsin (fixed x)
{
return _cos_tbl[((x - 0x400000 + 0x4000) >> 15) & 0x1FF];
return __mg_cos_tbl[((x - 0x400000 + 0x4000) >> 15) & 0x1FF];
}
/**
@@ -392,7 +392,7 @@ static inline fixed fixsin (fixed x)
*/
static inline fixed fixtan (fixed x)
{
return _tan_tbl[((x + 0x4000) >> 15) & 0xFF];
return __mg_tan_tbl[((x + 0x4000) >> 15) & 0xFF];
}
/**
@@ -415,7 +415,7 @@ static inline fixed fixacos (fixed x)
return 0;
}
return _acos_tbl[(x+65536+127)>>8];
return __mg_acos_tbl[(x+65536+127)>>8];
}
/**
@@ -438,7 +438,7 @@ static inline fixed fixasin (fixed x)
return 0;
}
return 0x00400000 - _acos_tbl[(x+65536+127)>>8];
return 0x00400000 - __mg_acos_tbl[(x+65536+127)>>8];
}
/** @} end of fixed_math_fns */

View File

@@ -154,7 +154,7 @@ fixed fixdiv (fixed dividend, fixed divisor)
return result;
}
fixed _cos_tbl[512] =
const fixed __mg_cos_tbl[512] =
{
/* precalculated fixed point (16.16) cosines for a full circle (0-255) */
@@ -226,7 +226,7 @@ fixed _cos_tbl[512] =
fixed _tan_tbl[256] =
const fixed __mg_tan_tbl[256] =
{
/* precalculated fixed point (16.16) tangents for a half circle (0-127) */
@@ -266,7 +266,7 @@ fixed _tan_tbl[256] =
fixed _acos_tbl[513] =
const fixed __mg_acos_tbl[513] =
{
/* precalculated fixed point (16.16) inverse cosines (-1 to 1) */
@@ -357,7 +357,7 @@ fixed fixatan(fixed x)
do {
c = (a + b) >> 1;
d = x - _tan_tbl[c];
d = x - __mg_tan_tbl[c];
if (d > 0)
a = c + 1;