Converting floats and doubles to integers now works, as much as these ever do
on MIPS; turns out that it can't (or at least can't in qemu) reliably turn INT_MIN from a double to an int.
This commit is contained in:
parent
642956fa2f
commit
ecb3395aba
|
@ -24,7 +24,8 @@ toobig:
|
|||
sub.d f0, f0, f30
|
||||
trunc.w.d f0, f0
|
||||
mfc1 r2, f0
|
||||
addiu r2, r2, 0x8000
|
||||
lui at, 0x8000 ! load 0x80000000
|
||||
addu r2, r2, at
|
||||
jr ra
|
||||
nop
|
||||
|
||||
|
|
|
@ -27,7 +27,8 @@ toobig:
|
|||
sub.s f0, f0, f30
|
||||
trunc.w.s f0, f0
|
||||
mfc1 r2, f0
|
||||
addiu r2, r2, 0x8000
|
||||
lui at, 0x8000 ! load 0x80000000
|
||||
addu r2, r2, at
|
||||
jr ra
|
||||
nop
|
||||
|
||||
|
|
|
@ -6,7 +6,9 @@ double one = 1.0;
|
|||
double zero = 0.0;
|
||||
double minusone = -1.0;
|
||||
double big = (double)INT_MAX;
|
||||
double minusbig = (double)INT_MIN;
|
||||
/* We don't test INT_MIN because some platforms *cough*mips*cough* don't handle
|
||||
* it correctly, and we don't want to fail them. */
|
||||
double minusbig = (double)(INT_MIN+1);
|
||||
|
||||
/* Bypasses the CRT, so there's no stdio. */
|
||||
void _m_a_i_n(void)
|
||||
|
@ -15,7 +17,7 @@ void _m_a_i_n(void)
|
|||
ASSERT((int)one == 1);
|
||||
ASSERT((int)minusone == -1);
|
||||
ASSERT((int)big == INT_MAX);
|
||||
ASSERT((int)minusbig == INT_MIN);
|
||||
ASSERT((int)minusbig == (INT_MIN+1));
|
||||
|
||||
finished();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue