diff options
author | Pixel <> | 2001-04-16 16:53:08 +0000 |
---|---|---|
committer | Pixel <> | 2001-04-16 16:53:08 +0000 |
commit | 967b751959b36a844abca8d3f4f32b8278f9bf9f (patch) | |
tree | 018b748fe0f40732a84f2a504196e62cff740672 /lib/alu.c | |
parent | 2f733d9f0da3d3a7032aea4f94be6a5fd257f193 (diff) |
Alu.h & pot files
Diffstat (limited to 'lib/alu.c')
-rw-r--r-- | lib/alu.c | 40 |
1 files changed, 24 insertions, 16 deletions
@@ -1,4 +1,6 @@ #include "alu.h" +#include "config.h" +#include "exceptions.h" // rajouter les overflow... @@ -95,8 +97,7 @@ Uint32 ValeurIbitsAuDeb(Uint32 nb, int i) Uint32 val, un = 1; if ((i > 31) || (i < 0)) { - fprintf(stderr, "erreur, ValeurIbitsAuDeb: la position demande n est pas dans l'intervalle"); - return (0); + exception(_("ValeurIbitsAuDeb: position not in interval")); } val = nb >> i; val = val & un; @@ -156,8 +157,7 @@ Uint32 InverseIbit(Uint32 nb, int i) Uint32 un = 1; if ((i > 31) || (i < 0)) { - fprintf(stderr, "erreur, InverseIbit: la position demande n est pas dans l'intervalle"); - return (0); + exception(_("InverseIbit: position not in interval")); } un = (un << i); return (nb ^ un); @@ -177,7 +177,7 @@ Uint32 InverseUint32(Uint32 x) return (val); } -Uint32 AndBit(Uint32 x, Uint32 y) +Uint32 NAND(Uint32 x, Uint32 y) { Uint32 m = 1, z = 0; int i; @@ -189,7 +189,7 @@ Uint32 AndBit(Uint32 x, Uint32 y) return (z); } -Uint32 OrBit(Uint32 x, Uint32 y) +Uint32 NOR(Uint32 x, Uint32 y) { Uint32 m = 1, z = 0; int i; @@ -201,16 +201,24 @@ Uint32 OrBit(Uint32 x, Uint32 y) return (z); } -Uint32 ShlUint32(Uint32 x, int i) +Uint32 NSHLi(Uint32 x, int i) { return (x << i); } -Uint32 ShrUint32(Uint32 x, int i) +Uint32 NSHRi(Uint32 x, int i) { return (x >> i); } +Uint32 NSHL(Uint32 x) { + return NSHLi(x, 1); +} + +Uint32 NSHR(Uint32 x) { + return NSHRi(x, 1); +} + Uint32 NAdditionNonSigne(Uint32 x, Uint32 y) { int i; @@ -315,7 +323,7 @@ Uint32 NAdditionSigne(Uint32 x, Uint32 y) return (add); } -Uint32 SoustractionNonSigne(Uint32 x, Uint32 y) +Uint32 NSoustractionNonSigne(Uint32 x, Uint32 y) { /* x - y */ int i; @@ -367,7 +375,7 @@ Uint32 SoustractionNonSigne(Uint32 x, Uint32 y) return (sou); } -Uint32 SoustractionSignee(Uint32 x, Uint32 y) +Uint32 NSoustractionSignee(Uint32 x, Uint32 y) { /* x - y */ int i; @@ -640,8 +648,8 @@ Uint32 NDivisionNonSigne(Uint32 a, Uint32 b) {} Uint32 NDivisionSigne(Uint32 a, Uint32 b) {} Uint32 NAND(Uint32 a, Uint32 b) {} Uint32 NOR(Uint32 a, Uint32 b) {} -Uint32 NSHR(Uint32 a, Uint32 b) {} -Uint32 NSHL(Uint32 a, Uint32 b) {} +Uint32 NSHR(Uint32 a) {} +Uint32 NSHL(Uint32 a) {} #endif Uint32 AdditionNonSigne(Uint32 a, Uint32 b) @@ -737,17 +745,17 @@ Uint32 OR(Uint32 a, Uint32 b) Uint32 SHL(Uint32 a) { if (Rapide) { - return RSHL(a, b); + return RSHL(a); } else { - return NSHL(a, b); + return NSHL(a); } } Uint32 SHR(Uint32 a) { if (Rapide) { - return RSHR(a, b); + return RSHR(a); } else { - return NSHR(a, b); + return NSHR(a); } } |