diff options
author | Pixel <> | 2001-04-16 15:14:46 +0000 |
---|---|---|
committer | Pixel <> | 2001-04-16 15:14:46 +0000 |
commit | dc8734708849108741cc634c0a75d88250b38180 (patch) | |
tree | 6a21ecdb637239e6a98b87574f690e26540b6fea /lib/alu-ralph.c | |
parent | e09044e963015cf672d0f992264ee1563717602a (diff) |
GROU
Diffstat (limited to 'lib/alu-ralph.c')
-rw-r--r-- | lib/alu-ralph.c | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/lib/alu-ralph.c b/lib/alu-ralph.c index a896c3c..87c4bc2 100644 --- a/lib/alu-ralph.c +++ b/lib/alu-ralph.c @@ -6,13 +6,13 @@ int errRet = 0; /*On compte de 0 à 31 */ - /*Return la valeur du ieme bite en position 0 */ -Uint32 ValeurIBitesAuDeb(Uint32 nb, int i) + /*Return la valeur du ieme bit en position 0 */ +Uint32 ValeurIbitsAuDeb(Uint32 nb, int i) { Uint32 val, un = 1; if ((i > 31) || (i < 0)) { - fprintf(stderr, "erreur, ValeurIBitesAuDeb: la position demande n est pas dans l'intervalle"); + fprintf(stderr, "erreur, ValeurIbitsAuDeb: la position demande n est pas dans l'intervalle"); return (0); } val = nb >> i; @@ -21,13 +21,13 @@ Uint32 ValeurIBitesAuDeb(Uint32 nb, int i) } - /*Return la valeur du ieme bite en sa position d origine */ + /*Return la valeur du ieme bit en sa position d origine */ /* -Uint32 ValeurIBite(Uint32 nb, int i) { +Uint32 ValeurIbit(Uint32 nb, int i) { Uint32 val = 0, un = 1; if ((i > 31) || (i < 0)) { - fprintf(stderr, "erreur, ValeurIBite: la position demande n est pas dans l'intervalle"); + fprintf(stderr, "erreur, ValeurIbit: la position demande n est pas dans l'intervalle"); return (0); } val = un << i; @@ -36,8 +36,8 @@ Uint32 ValeurIBite(Uint32 nb, int i) { } */ - /*Met a vrai le ieme bite */ -Uint32 MettreAVIBite(Uint32 nb, int i) + /*Met a vrai le ieme bit */ +Uint32 MettreAVIbit(Uint32 nb, int i) { Uint32 val = 1; @@ -67,13 +67,13 @@ Uint32 MetAFUint32(void) } - /* Inverse la valeur du i eme bite */ -Uint32 InverseIBite(Uint32 nb, int i) + /* Inverse la valeur du i eme bit */ +Uint32 InverseIbit(Uint32 nb, int i) { Uint32 un = 1; if ((i > 31) || (i < 0)) { - fprintf(stderr, "erreur, InverseIBite: la position demande n est pas dans l'intervalle"); + fprintf(stderr, "erreur, InverseIbit: la position demande n est pas dans l'intervalle"); return (0); } un = (un << i); @@ -89,7 +89,7 @@ Uint32 InverseUint32(Uint32 x) Uint32 val = x; for (i = 0; i <= 31; i++) { - val = InverseIBite(val, i); + val = InverseIbit(val, i); } return (val); } @@ -139,8 +139,8 @@ Uint32 AddNonSigUint32(Uint32 x, Uint32 y) if (y == 0) return (x); for (i = 0; i < 32; i++) { - a = ValeurIBitesAuDeb(x, i); - b = ValeurIBitesAuDeb(y, i); + a = ValeurIbitsAuDeb(x, i); + b = ValeurIbitsAuDeb(y, i); tp = a + b + ret; if (tp == 3) { ret = 1; @@ -191,8 +191,8 @@ Uint32 AddSigUint32(Uint32 x, Uint32 y) if (y == 0) return (x); for (i = 0; i < 32; i++) { - a = ValeurIBitesAuDeb(x, i); - b = ValeurIBitesAuDeb(y, i); + a = ValeurIbitsAuDeb(x, i); + b = ValeurIbitsAuDeb(y, i); tp = a + b + ret; if (tp == 3) { ret = 1; @@ -239,8 +239,8 @@ Uint32 SousNonSigUint32(Uint32 x, Uint32 y) Uint32 a, b, tp, sou = 0, ret = 0; for (i = 0; i < 32; i++) { - a = ValeurIBitesAuDeb(x, i); - b = ValeurIBitesAuDeb(y, i); + a = ValeurIbitsAuDeb(x, i); + b = ValeurIbitsAuDeb(y, i); if (((a == 0) && (b == 0) && (ret == 0)) || ((a == 1) && (b == 1) && (ret == 0)) || ((a == 1) && (b == 0) && (ret == 1))) { ret = 0; @@ -291,8 +291,8 @@ Uint32 SousSigUint32(Uint32 x, Uint32 y) Uint32 a, b, tp, sou = 0, ret = 0; for (i = 0; i < 32; i++) { - a = ValeurIBitesAuDeb(x, i); - b = ValeurIBitesAuDeb(y, i); + a = ValeurIbitsAuDeb(x, i); + b = ValeurIbitsAuDeb(y, i); if (((a == 0) && (b == 0) && (ret == 0)) || ((a == 1) && (b == 1) && (ret == 0)) || ((a == 1) && (b == 0) && (ret == 1))) { ret = 0; @@ -344,8 +344,8 @@ couple Addition(Uint32 x, Uint32 y) Uint32 a, b, tp, add = 0, ret = 0; for (i = 0; i < 32; i++) { - a = ValeurIBitesAuDeb(x, i); - b = ValeurIBitesAuDeb(y, i); + a = ValeurIbitsAuDeb(x, i); + b = ValeurIbitsAuDeb(y, i); tp = a + b + ret; if (tp == 3) { ret = 1; @@ -396,8 +396,8 @@ couple Add30Mul(Uint32 x, Uint32 y) Uint32 a, b, tp, add = 0, ret = 0; for (i = 0; i < 31; i++) { - a = ValeurIBitesAuDeb(x, i); - b = ValeurIBitesAuDeb(y, i); + a = ValeurIbitsAuDeb(x, i); + b = ValeurIbitsAuDeb(y, i); tp = a + b + ret; if (tp == 3) { ret = 1; @@ -453,7 +453,7 @@ Uint32 MultChifNomb(Uint32 x, Uint32 y) if (y == 1) return (x); for (i = 0; i < 32; i++) { - a = ValeurIBitesAuDeb(x, i); + a = ValeurIbitsAuDeb(x, i); if (a == 1) { un <<= i; mul |= un; @@ -470,7 +470,7 @@ couple MultipliNonSig(Uint32 x, Uint32 y) Uint32 tp, dec, add, a, pa1 = 0, pa2 = 0; for (i = 0; i < 32; i++) { - a = ValeurIBitesAuDeb(y, i); + a = ValeurIbitsAuDeb(y, i); tp = MultChifNomb(x, a); fprintf(stdout, "tp = %Lu\n", tp); dec = (tp >> (32 - i)); @@ -499,15 +499,15 @@ couple MultipliSig(Uint32 x, Uint32 y) Uint32 tp, dec, add, a, b, pa1 = 0, pa2 = 0, x1 = x, y1 = y; - a = ValeurIBitesAuDeb(x, 31); - b = ValeurIBitesAuDeb(y, 31); + a = ValeurIbitsAuDeb(x, 31); + b = ValeurIbitsAuDeb(y, 31); if (((a == 0) && (b == 0)) || ((a == 1) && (b == 1))) { /* Le resultat sera pos */ if ((a == 1) && (b == 1)) { - x1 = InverseIBite(x, 31); - y1 = InverseIBite(y, 31); + x1 = InverseIbit(x, 31); + y1 = InverseIbit(y, 31); } for (i = 0; i < 31; i++) { - a = ValeurIBitesAuDeb(y1, i); + a = ValeurIbitsAuDeb(y1, i); tp = MultChifNomb(x1, a); dec = tp >> (31 - i); w = Addition(pa2, dec); @@ -525,11 +525,11 @@ couple MultipliSig(Uint32 x, Uint32 y) return (z); } if (a == 1) - x1 = InverseIBite(x, 31); + x1 = InverseIbit(x, 31); if (b == 1) - y1 = InverseIBite(y, 31); + y1 = InverseIbit(y, 31); for (i = 0; i < 31; i++) { - a = ValeurIBitesAuDeb(y1, i); + a = ValeurIbitsAuDeb(y1, i); tp = MultChifNomb(x1, a); dec = tp >> (31 - i); pa2 = AddNonSigUint32(pa2, dec); @@ -540,8 +540,8 @@ couple MultipliSig(Uint32 x, Uint32 y) pa2 = AddNonSigUint32(pa2, 1); } } - pa1 = MettreAVIBite(pa1, 31); - pa2 = MettreAVIBite(pa2, 31); + pa1 = MettreAVIbit(pa1, 31); + pa2 = MettreAVIbit(pa2, 31); z.deb = pa1; z.fin = pa2; return (z); |