mirror of
https://github.com/vishapoberon/compiler.git
synced 2026-04-06 14:32:24 +00:00
SYSTEM.ADDRESS signed (again), DIV, MOD full integer support, ASH and checks support 64 bit ints.
Change (back) to address type being signed. DIV and MOD fully defined for the full range of integer on both parameters. _X, _XF, _R and _RF checks upgraded for 64 bit support. ASH upgraded for 64 bit. Add div and mod tests to language confidence test. Enable debuggable C compiler options.
This commit is contained in:
parent
ebfc60f49d
commit
83aaa70290
8 changed files with 146 additions and 64 deletions
|
|
@ -21,11 +21,34 @@
|
|||
// Procedure verions of SYSTEM.H versions used when a multiply accessed
|
||||
// parameter has side effects.
|
||||
|
||||
int64 SYSTEM_XCHK(uint64 i, uint64 ub) {return __X(i, ub);}
|
||||
int64 SYSTEM_RCHK(uint64 i, uint64 ub) {return __R(i, ub);}
|
||||
LONGINT SYSTEM_ASH (LONGINT i, LONGINT n) {return __ASH(i, n);}
|
||||
LONGINT SYSTEM_ABS (LONGINT i) {return __ABS(i);}
|
||||
double SYSTEM_ABSD(double i) {return __ABS(i);}
|
||||
|
||||
|
||||
LONGINT SYSTEM_ABS (LONGINT i) {return __ABS(i);}
|
||||
double SYSTEM_ABSD(double i) {return __ABS(i);}
|
||||
|
||||
|
||||
int64 SYSTEM_DIV(int64 x, int64 y)
|
||||
{
|
||||
if (x == 0) return 0;
|
||||
if (x >= 0)
|
||||
if (y >= 0) {return x/y;}
|
||||
else {return -((x-y-1)/(-y));}
|
||||
else
|
||||
if (y >= 0) {return -((y-x-1)/y);}
|
||||
else {return (-x)/(-y);}
|
||||
}
|
||||
|
||||
int64 SYSTEM_MOD(int64 x, int64 y)
|
||||
{
|
||||
if (x == 0) return 0;
|
||||
if (x >= 0)
|
||||
if (y >= 0) {return x % y;}
|
||||
else {return (y+1) + ((x-1) % (-y));}
|
||||
else
|
||||
if (y >= 0) {return (y-1) - ((-x-1) % y);}
|
||||
else {return -((-x) % (-y));}
|
||||
}
|
||||
|
||||
|
||||
void SYSTEM_INHERIT(LONGINT *t, LONGINT *t0)
|
||||
{
|
||||
|
|
@ -57,19 +80,6 @@ void SYSTEM_ENUMR(void *adr, LONGINT *typ, LONGINT size, LONGINT n, void (*P)())
|
|||
}
|
||||
}
|
||||
|
||||
LONGINT SYSTEM_DIV(uint64 x, uint64 y)
|
||||
{ if ((int64) x >= 0) return (x / y);
|
||||
else return -((y - 1 - x) / y);
|
||||
}
|
||||
|
||||
LONGINT SYSTEM_MOD(uint64 x, uint64 y)
|
||||
{ uint64 m;
|
||||
if ((int64) x >= 0) return (x % y);
|
||||
else { m = (-x) % y;
|
||||
if (m != 0) return (y - m); else return 0;
|
||||
}
|
||||
}
|
||||
|
||||
LONGINT SYSTEM_ENTIER(double x)
|
||||
{
|
||||
LONGINT y;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue