diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2008-08-23 11:16:44 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2008-08-23 11:16:44 +0200 |
commit | 07d5a8085bbcc21a1d9d06a2976ecc00e9c8d55b (patch) | |
tree | b07a53afeb56f4bba917c1a3a843f48dd25b62be /nim/nsystem.pas | |
parent | 916c25f9a70b68eb7a5e2c45d7cc2e10c6e3a525 (diff) | |
download | Nim-07d5a8085bbcc21a1d9d06a2976ecc00e9c8d55b.tar.gz |
too many changes to list
Diffstat (limited to 'nim/nsystem.pas')
-rw-r--r-- | nim/nsystem.pas | 45 |
1 files changed, 42 insertions, 3 deletions
diff --git a/nim/nsystem.pas b/nim/nsystem.pas index 0b8b897c2..9f3adfc7d 100644 --- a/nim/nsystem.pas +++ b/nim/nsystem.pas @@ -90,10 +90,11 @@ type TAddress = longint; {$endif} +var + NaN: float; + inf: float; + NegInf: float; {$ifdef fpc} -const - inf = math.Infinity; - NegInf = -inf; {$else} {$ifopt Q+} {$define Q_on} @@ -150,6 +151,10 @@ function shlU(a, b: biggestInt): biggestInt; function shrU(a, b: biggestInt): biggestInt; function ltU(a, b: biggestInt): bool; function leU(a, b: biggestInt): bool; + +function toU8(a: biggestInt): byte; +function toU32(a: biggestInt): int32; +function ze64(a: byte): biggestInt; {@emit} function alloc(size: int): Pointer; @@ -257,6 +262,23 @@ function leU(a, b: biggestInt): bool; begin result := biggestUInt(a) < biggestUInt(b); end; + +function toU8(a: biggestInt): byte; +begin + assert(a >= 0); + assert(a <= 255); + result := a; +end; + +function toU32(a: biggestInt): int32; +begin + result := int32(a and $ffffffff); +end; + +function ze64(a: byte): biggestInt; +begin + result := a +end; {@emit} procedure addChar(var s: string; c: Char); @@ -486,4 +508,21 @@ end; {$ifdef I_on} {$undef I_on} {$I+} {$endif} +{$ifopt R+} {$R-,Q-} {$define R_on} {$endif} +var + zero: float; + Saved8087CW: Word; +initialization + Saved8087CW := Default8087CW; + Set8087CW($133f); // Disable all fpu exceptions + + zero := 0.0; + NaN := 0.0 / zero; + inf := 1.0 / zero; + NegInf := -inf; +finalization + Set8087CW(Saved8087CW); +{$ifdef R_on} + {$R+,Q+} +{$endif} end. |