Revert FLOAT_U* and DOUBLE_U* macros

This commit is contained in:
PikalaxALT 2019-06-30 19:31:29 -04:00
parent 92f17e8812
commit f300f9e699
3 changed files with 6 additions and 31 deletions

View File

@ -192,29 +192,4 @@
REG_IME = imeTemp; \ REG_IME = imeTemp; \
} \ } \
#if MODERN
#define FLOAT_UNS(x, bit) ({ \
s##bit sx = x; \
float fx = (float)sx; \
if (sx < 0) fx += (1 << (bit - 1)) * 2.0f; \
fx; \
})
#define DOUBLE_UNS(x, bit) ({ \
s##bit sx = x; \
double dx = (double)sx; \
if (sx < 0) dx += (1 << (bit - 1)) * 2.0; \
dx; \
})
#else
#define FLOAT_UNS(x, bit) ((float)(x))
#define DOUBLE_UNS(x, bit) ((double)(x))
#endif //MODERN
#define FLOAT_U8(x) FLOAT_UNS(x, 8)
#define FLOAT_U16(x) FLOAT_UNS(x, 16)
#define FLOAT_U32(x) FLOAT_UNS(x, 32)
#define DOUBLE_U8(x) DOUBLE_UNS(x, 8)
#define DOUBLE_U16(x) DOUBLE_UNS(x, 16)
#define DOUBLE_U32(x) DOUBLE_UNS(x, 32)
#endif // GUARD_GBA_MACRO_H #endif // GUARD_GBA_MACRO_H

View File

@ -97,7 +97,7 @@ static void FormatMonSizeRecord(u8 *string, u32 size)
{ {
#ifdef UNITS_IMPERIAL #ifdef UNITS_IMPERIAL
//Convert size from centimeters to inches //Convert size from centimeters to inches
size = DOUBLE_U32(size * 10) / (CM_PER_INCH * 10); size = (double)(size * 10) / (CM_PER_INCH * 10);
#endif #endif
string = ConvertIntToDecimalStringN(string, size / 10, 0, 8); string = ConvertIntToDecimalStringN(string, size / 10, 0, 8);

View File

@ -3969,7 +3969,7 @@ static void sub_8144410(struct Sprite *sprite)
if (!sub_8143B48(sprite)) if (!sub_8143B48(sprite))
{ {
gUnknown_0203AB88->var90 = 0.0f; gUnknown_0203AB88->var90 = 0.0f;
gUnknown_0203AB88->var8C -= FLOAT_U8(gUnknown_085B6348[gUnknown_0203AB88->var04_0].var03) gUnknown_0203AB88->var8C -= (float)(gUnknown_085B6348[gUnknown_0203AB88->var04_0].var03)
/ (gUnknown_085B6348[gUnknown_0203AB88->var04_0].var04 + 1); / (gUnknown_085B6348[gUnknown_0203AB88->var04_0].var04 + 1);
sprite->data[1] = 4; sprite->data[1] = 4;
sprite->callback = sub_8144264; sprite->callback = sub_8144264;
@ -3994,8 +3994,8 @@ static void sub_8144514(struct Sprite *sprite)
if (gUnknown_0203AB88->var94 > 40.f) if (gUnknown_0203AB88->var94 > 40.f)
return; return;
gUnknown_0203AB88->var98 = -(4.0f / FLOAT_U16(gUnknown_0203AB88->var86)); gUnknown_0203AB88->var98 = -(4.0f / (float)(gUnknown_0203AB88->var86));
gUnknown_0203AB88->var90 = -(gUnknown_0203AB88->var8C / FLOAT_U16(gUnknown_0203AB88->var86)); gUnknown_0203AB88->var90 = -(gUnknown_0203AB88->var8C / (float)(gUnknown_0203AB88->var86));
sprite->animNum = 2; sprite->animNum = 2;
sprite->animBeginning = TRUE; sprite->animBeginning = TRUE;
sprite->animEnded = FALSE; sprite->animEnded = FALSE;
@ -4010,8 +4010,8 @@ static void sub_81445D8(struct Sprite *sprite)
return; return;
m4aSongNumStartOrChange(SE_TAMAKORO_E); m4aSongNumStartOrChange(SE_TAMAKORO_E);
gUnknown_0203AB88->var98 = -(20.0f / FLOAT_U16(gUnknown_0203AB88->var84)); gUnknown_0203AB88->var98 = -(20.0f / (float)(gUnknown_0203AB88->var84));
gUnknown_0203AB88->var90 = ((1.0f - gUnknown_0203AB88->var8C) / FLOAT_U16(gUnknown_0203AB88->var84)); gUnknown_0203AB88->var90 = ((1.0f - gUnknown_0203AB88->var8C) / (float)(gUnknown_0203AB88->var84));
sprite->animNum = 1; sprite->animNum = 1;
sprite->animBeginning = TRUE; sprite->animBeginning = TRUE;
sprite->animEnded = FALSE; sprite->animEnded = FALSE;