libsrc/tumble.cxx File Reference

tumbler arithmetic routines More...

#include "udanax.h"

Include dependency graph for tumble.cxx:

Include dependency graph

Go to the source code of this file.

Functions

int abscmp (Tumbler *aptr, Tumbler *bptr)
 ???

bool tumblereq (Tumbler *a, Tumbler *b)
 ???

bool tumbleraccounteq (Tumbler *aptr, Tumbler *bptr)
 ???

int tumblercmp (Tumbler *aptr, Tumbler *bptr)
 ???

int intervalcmp (Tumbler *left, Tumbler *right, Tumbler *address)
 ???

bool tumblercheckptr (Tumbler *ptr, int *crumptr)
 ???

bool tumblercheck (Tumbler *ptr)
 ???

bool is1story (Tumbler *tumblerptr)
 ???

int nstories (Tumbler *tumblerptr)
 ???

int tumblerlength (Tumbler *tumblerptr)
 ???

int lastdigitintumbler (Tumbler *tumblerptr)
 ???

void tumblerjustify (Tumbler *tumblerptr)
 ???

void partialtumblerjustify (Tumbler *tumblerptr)
void tumblercopy (Tumbler *fromptr, Tumbler *toptr)
 ???

void tumblermax (Tumbler *aptr, Tumbler *bptr, Tumbler *cptr)
 ???

void functiontumbleradd (Tumbler *aptr, Tumbler *bptr, Tumbler *cptr)
 ???

void tumblersub (Tumbler *aptr, Tumbler *bptr, Tumbler *cptr)
 ???

void absadd (Tumbler *aptr, Tumbler *bptr, Tumbler *cptr)
 ???

void strongsub (Tumbler *aptr, Tumbler *bptr, Tumbler *cptr)
 ???

void weaksub (Tumbler *aptr, Tumbler *bptr, Tumbler *cptr)
 ???

int tumblerintdiff (Tumbler *aptr, Tumbler *bptr)
 ???

void tumblerincrement (Tumbler *aptr, int rightshift, int bint, Tumbler *cptr)
 ???

void tumblertruncate (Tumbler *aptr, int bint, Tumbler *cptr)
 ???

void prefixtumbler (Tumbler *aptr, int bint, Tumbler *cptr)
 ???

void beheadtumbler (Tumbler *aptr, Tumbler *bptr)
 ???

void docidandvstream2tumbler (Tumbler *docid, Tumbler *vstream, Tumbler *tumbleptr)
 ???


Variables

Tumbler ZEROTUMBLERvar


Detailed Description

tumbler arithmetic routines

(to be defined)

Definition in file tumble.cxx.


Function Documentation

void absadd Tumbler aptr,
Tumbler bptr,
Tumbler cptr
 

???

(to be defined)

Definition at line 665 of file tumble.cxx.

References Tumbler::exp, Tumbler::mantissa, movetumbler, NPLACES, Tumbler::sign, tdigit, Tumbler::varandnotfixed, and Tumbler::xvartumbler.

Referenced by functiontumbleradd().

00669 {
00670     int i, j;
00671     //UNUSED int place;
00672     int temp;
00673     tdigit *ansmant;
00674     tdigit *bmant, *amant;
00675     Tumbler answer;
00676 
00677     i = j = 0;
00678     amant = aptr->mantissa;
00679     bmant = bptr->mantissa;
00680     answer.xvartumbler = 0;
00681     answer.varandnotfixed = 0;
00682     answer.sign = 0;
00683     ansmant = answer.mantissa;
00684 
00685     if (aptr->exp == bptr->exp) {
00686         answer.exp = aptr->exp;
00687         ansmant[0] = amant[0] + bmant[0];
00688         i = j = 1;
00689 
00690     } else if (aptr->exp > bptr->exp) {
00691         answer.exp = aptr->exp;
00692         temp = aptr->exp - bptr->exp;
00693         while (i < temp) {
00694             ansmant[j++] = amant[i++];
00695         }
00696         ansmant[j++] = amant[i++] + bmant[0];
00697         i = 1;
00698 
00699     } else {
00700         answer.exp = bptr->exp;
00701         temp = bptr->exp - aptr->exp;
00702         while (i <= temp) {
00703             ansmant[j++] = bmant[i++];
00704         }
00705     }
00706 
00707     while (j <= NPLACES - 1)
00708         ansmant[j++] = bmant[i++];
00709 
00710     movetumbler(&answer, cptr);
00711 }

int abscmp Tumbler aptr,
Tumbler bptr
[static]
 

???

(to be defined)

Definition at line 183 of file tumble.cxx.

References EQUAL, Tumbler::exp, GREATER, LESS, Tumbler::mantissa, and NPLACES.

Referenced by functiontumbleradd(), and tumblercmp().

00186 {
00187     int *a, *b;
00188     int i, cmp;
00189 
00190     if (aptr->exp != bptr->exp) {
00191         if (aptr->exp < bptr->exp) {
00192             return LESS;
00193         } else {
00194             return GREATER;
00195         }
00196 
00197     } else {
00198         a = (int *) aptr->mantissa;
00199         b = (int *) bptr->mantissa;
00200         for (i = NPLACES; i--;) {
00201             if (!(cmp = *a++ - *b++)) {
00202             } else if (cmp < 0) {
00203                 return LESS;         /* a < b */
00204             } else {                   /* if (cmp > 0) */
00205                 return GREATER;
00206             }
00207         }
00208     }
00209     return EQUAL;
00210 }

void beheadtumbler Tumbler aptr,
Tumbler bptr
 

???

(to be defined)

Definition at line 986 of file tumble.cxx.

References Tumbler::exp, Tumbler::mantissa, movetumbler, and tumblerjustify().

Referenced by findaddressofsecondcutforinsert(), finddocscontainingsp(), and sporglset2linksetinrange().

00989 {
00990     Tumbler temp;
00991 
00992     movetumbler(aptr, &temp);
00993     ++temp.exp;
00994 
00995     if (aptr->exp == 0)
00996         temp.mantissa[0] = 0;
00997 
00998     tumblerjustify(&temp);
00999     movetumbler(&temp, bptr);
01000 }

void docidandvstream2tumbler Tumbler docid,
Tumbler vstream,
Tumbler tumbleptr
 

???

(to be defined)

Definition at line 1010 of file tumble.cxx.

References Tumbler::mantissa, movetumbler, and NPLACES.

Referenced by makespanpair().

01014 {
01015     int i, j;
01016 
01017     movetumbler(docid, tumbleptr);
01018     for (i = NPLACES - 1; i >= 0; i--) {
01019         if (tumbleptr->mantissa[i]) {
01020             ++i;
01021             break;
01022         }
01023     }
01024     for (j = 0; i < NPLACES && j < NPLACES;)
01025         tumbleptr->mantissa[++i] = vstream->mantissa[j++];
01026 }

void functiontumbleradd Tumbler aptr,
Tumbler bptr,
Tumbler cptr
 

???

(to be defined)

Definition at line 571 of file tumble.cxx.

References absadd(), abscmp(), GREATER, iszerotumbler, Tumbler::mantissa, movetumbler, partialtumblerjustify(), Tumbler::sign, strongsub(), and weaksub().

00577 {
00578     if (iszerotumbler(bptr)) {
00579         movetumbler(aptr, cptr);
00580         return;
00581 
00582     } else if (iszerotumbler(aptr)) {
00583         movetumbler(bptr, cptr);
00584         return;
00585 
00586     } else if (aptr->sign == bptr->sign) {
00587         absadd(aptr, bptr, cptr);
00588         cptr->sign = aptr->sign;
00589 /* absadd returns justified result so no need to justify */
00590 /* I'm not so sure of the subtracts, they aren't used much */
00591 /* 
00592  * if(cptr->mantissa[0] == 0){ partialtumblerjustify (cptr); } */
00593     } else if (abscmp(aptr, bptr) == GREATER) {
00594         strongsub(aptr, bptr, cptr);
00595         cptr->sign = aptr->sign;
00596         if (cptr->mantissa[0] == 0) {
00597             partialtumblerjustify(cptr);
00598         }
00599     } else {
00600         weaksub(bptr, aptr, cptr);
00601         cptr->sign = bptr->sign;
00602         if (cptr->mantissa[0] == 0) {
00603             partialtumblerjustify(cptr);
00604         }
00605     }
00606 /* tumblercheck (cptr); */
00607 /* 
00608  * if (cptr->sign) { L("TUMBLERADD NEGATIVE OUTPUT\n");
00609  * dumptumbler(cptr); L("\n"); } */
00610 }

int intervalcmp Tumbler left,
Tumbler right,
Tumbler address
 

???

(to be defined)

Definition at line 261 of file tumble.cxx.

References EQUAL, LESS, ONMYLEFTBORDER, ONMYRIGHTBORDER, THRUME, TOMYLEFT, TOMYRIGHT, and tumblercmp().

Referenced by whereoncontext(), and whereoncrum().

00265 {
00266     int cmp;
00267 
00268     cmp = tumblercmp(address, left);
00269     if (cmp == LESS)
00270         return TOMYLEFT;
00271 
00272     else if (cmp == EQUAL)
00273         return ONMYLEFTBORDER;
00274 
00275     cmp = tumblercmp(address, right);
00276     if (cmp == LESS)
00277         return THRUME;
00278     else if (cmp == EQUAL)
00279         return ONMYRIGHTBORDER;
00280     else
00281         return TOMYRIGHT;
00282 }

bool is1story Tumbler tumblerptr  ) 
 

???

(to be defined)

Definition at line 386 of file tumble.cxx.

References Tumbler::mantissa, and NPLACES.

Referenced by istextcrum(), lockis1story(), retrievevspansetpm(), and slicecbcpm().

00388 {
00389     int i;
00390 
00391     //assert( tumblercheck(tumblerptr) );
00392     
00393     for (i = 1; i < NPLACES; i++)
00394         if (tumblerptr->mantissa[i] != 0)
00395             return false;
00396     return true;
00397 }

int lastdigitintumbler Tumbler tumblerptr  ) 
 

???

(to be defined)

Definition at line 445 of file tumble.cxx.

References Tumbler::mantissa, and nstories().

Referenced by widdiffs().

00447 {
00448     int n, digit;
00449 
00450     n = nstories(tumblerptr);
00451     digit = tumblerptr->mantissa[n - 1];
00452     return digit;
00453 }

int nstories Tumbler tumblerptr  ) 
 

???

(to be defined)

Definition at line 407 of file tumble.cxx.

References Tumbler::mantissa, and NPLACES.

Referenced by dumpisagr(), lastdigitintumbler(), tumblerfixedtoptr(), and tumblerlength().

00409 {
00410     int i;
00411 
00412     //assert( tumblercheck(tumblerptr) );
00413     
00414     for (i = NPLACES; i > 0 && tumblerptr->mantissa[--i] == 0; )
00415         ;
00416 
00417     return i + 1;
00418 }

void partialtumblerjustify Tumbler tumblerptr  )  [static]
 

Definition at line 496 of file tumble.cxx.

References Tumbler::exp, Tumbler::mantissa, NPLACES, Tumbler::sign, and tdigit.

Referenced by functiontumbleradd().

00498 {
00499     int i, j;
00500     int shift;
00501     tdigit *mantissaptr;
00502 
00503     mantissaptr = tumblerptr->mantissa;
00504 /* test commented out because is done before this routine is called for efficiency */
00505 /* if (mantissaptr[0] != 0) { return; } */
00506     for (shift = 0; mantissaptr[shift] == 0; ++shift) {
00507         if (shift == NPLACES - 1) {
00508             tumblerptr->exp = 0;
00509             tumblerptr->sign = 0;
00510             return;
00511         }
00512     }
00513 
00514     for (i = 0, j = shift; j < NPLACES;)
00515         mantissaptr[i++] = mantissaptr[j++];
00516 
00517     while (i < NPLACES)
00518         mantissaptr[i++] = 0;
00519 
00520     tumblerptr->exp -= shift;
00521 
00522     //assert( tumblercheck(tumblerptr) );
00523 }

void prefixtumbler Tumbler aptr,
int  bint,
Tumbler cptr
 

???

(to be defined)

Definition at line 953 of file tumble.cxx.

References Tumbler::exp, iszerotumbler, Tumbler::mantissa, movetumbler, tumbleradd, and tumblerclear.

Referenced by insertspanf(), and sporglset2linksetinrange().

00957 {
00958     Tumbler temp1, temp2;
00959 
00960     tumblerclear(&temp1);
00961     temp1.mantissa[0] = bint;
00962     movetumbler(aptr, &temp2);
00963 
00964     if (!iszerotumbler(&temp2))        /* yuckh! */
00965         temp2.exp -= 1;
00966 
00967     tumbleradd(&temp1, &temp2, cptr);
00968 }

void strongsub Tumbler aptr,
Tumbler bptr,
Tumbler cptr
 

???

(to be defined)

Definition at line 776 of file tumble.cxx.

References Tumbler::exp, Tumbler::mantissa, movetumbler, NPLACES, tumblerclear, and tumblereq().

Referenced by functiontumbleradd().

00780 {
00781     Tumbler answer;
00782     int i, j;
00783 
00784     tumblerclear(&answer);
00785     if (tumblereq(aptr, bptr)) {
00786         movetumbler(&answer, cptr);
00787         return;
00788     }
00789 
00790     if (bptr->exp < aptr->exp) {
00791         movetumbler(aptr, cptr);
00792         return;
00793     }
00794 
00795     answer.exp = aptr->exp;
00796     for (i = 0; aptr->mantissa[i] == bptr->mantissa[i]; ++i) {
00797         --answer.exp;
00798         if (i >= NPLACES) {
00799             movetumbler(&answer, cptr);
00800             return;
00801         }
00802     }
00803 
00804     answer.mantissa[0] = aptr->mantissa[i] - bptr->mantissa[i];
00805     if (++i >= NPLACES) {
00806         movetumbler(&answer, cptr);
00807         return;
00808     }
00809 
00810     for (j = 1; j < NPLACES && i < NPLACES;)
00811         answer.mantissa[j++] = aptr->mantissa[i++];
00812 
00813     movetumbler(&answer, cptr);
00814 }

bool tumbleraccounteq Tumbler aptr,
Tumbler bptr
 

???

(to be defined)

Definition at line 127 of file tumble.cxx.

References Tumbler::exp, Tumbler::mantissa, NPLACES, and Tumbler::sign.

Referenced by docreatenewversion(), and isthisusersdocument().

00130 {
00131     int i, j;
00132 
00133     if (aptr->exp != bptr->exp || aptr->sign != bptr->sign)
00134         return false;
00135 
00136     for (j = 0, i = 0; i < NPLACES; i++) {
00137         if (aptr->mantissa[i] != bptr->mantissa[i])
00138             return false;
00139 
00140         if (aptr->mantissa[i] == 0 && ++j == 2)
00141             return true;
00142     }
00143     return true;
00144 }

bool tumblercheck Tumbler ptr  ) 
 

???

(to be defined)

Definition at line 371 of file tumble.cxx.

References NULL, and tumblercheckptr().

Referenced by puttumbler().

00373 {
00374     return tumblercheckptr(ptr, (int *) NULL);
00375 }

bool tumblercheckptr Tumbler ptr,
int *  crumptr
 

???

(to be defined)

Definition at line 294 of file tumble.cxx.

References assert, dump(), dumptumbler(), dumpwholetree(), Tumbler::exp, L, Tumbler::mantissa, NPLACES, Tumbler::sign, and typecorecrum.

Referenced by assertwidsarepositive(), newpeelcrumoffnd(), and tumblercheck().

00297 {
00298     bool wrong;
00299     int i;
00300 
00301     wrong = false;
00302     if (ptr->exp > 0) {
00303 #ifndef DISTRIBUTION
00304         L("bad exp ");
00305 #endif
00306         wrong = true;
00307     }
00308 
00309     if (ptr->sign && ptr->mantissa[0] == 0) {
00310 #ifndef DISTRIBUTION
00311         L(" negative zero ");
00312 #endif
00313         wrong = true;
00314     }
00315 
00316     if (ptr->exp && ptr->mantissa[0] == 0) {
00317 #ifndef DISTRIBUTION
00318         L("fucked up non-normalized");
00319 #endif
00320         wrong = true;
00321     }
00322 
00323     if (ptr->mantissa[0] == 0) {
00324         for (i = 1; i < NPLACES; ++i) {
00325             if (ptr->mantissa[i] != 0) {
00326 #ifndef DISTRIBUTION
00327                 L("nonzerozerotumbler");
00328 #endif
00329                 wrong = true;
00330             }
00331         }
00332     }
00333 
00334     for (i = 0; i < NPLACES; ++i) {
00335         if ((int) (ptr->mantissa[i]) < 0) {
00336 #ifndef DISTRIBUTION
00337             L("negative digit");
00338 #endif
00339             wrong = true;
00340         }
00341     }
00342 
00343     if (wrong) {
00344 #ifndef DISTRIBUTION
00345         dumptumbler(ptr);
00346         if (crumptr) {
00347             dump((typecorecrum *) crumptr);
00348         }
00349         L("\n\n invalid tumbler \n\n");
00350         if (crumptr) {
00351             dumpwholetree((typecorecrum *) crumptr);
00352         }
00353         assert(0); // invalid tumbler
00354 #else
00355         assert(0);
00356 #endif
00357         return false;
00358     }
00359 
00360     return true;
00361 }

int tumblercmp Tumbler aptr,
Tumbler bptr
 

???

(to be defined)

Definition at line 154 of file tumble.cxx.

References abscmp(), EQUAL, GREATER, iszerotumbler, LESS, and Tumbler::sign.

Referenced by comparecrumsdiagonally(), context2span(), context2vtext(), fetchorglgr(), findisatoinsertmolecule(), findnextaddressinvspace(), findnextlinkvsa(), findsontoinsertundernd(), findvsatoappend(), insertpm(), intervalcmp(), makegappm(), makeroomonleftnd(), makespanpairsforispan(), putvspaninlist(), removespansnotinoriginal(), retrieveinspan(), shellsort(), sortknives(), spanintersection(), splitcrumpm(), tumblermax(), and whereoncrum().

00157 {
00158     if (iszerotumbler(aptr)) {
00159         if (iszerotumbler(bptr))
00160             return EQUAL;
00161         else
00162             return (bptr->sign ? GREATER : LESS);
00163     }
00164 
00165     if (iszerotumbler(bptr))
00166         return (aptr->sign ? LESS : GREATER);
00167 
00168     if (aptr->sign == bptr->sign)
00169         return (aptr->sign ? abscmp(bptr, aptr) : abscmp(aptr, bptr));
00170 
00171     return (aptr->sign ? LESS : GREATER);
00172 }

void tumblercopy Tumbler fromptr,
Tumbler toptr
 

???

(to be defined)

Definition at line 533 of file tumble.cxx.

References movetumbler.

Referenced by addtoopen(), docreatenode_or_account(), doopen(), insertnd(), klugefindisatoinsertnonmolecule(), and maxtextwid().

00536 {
00537 /* movmem (fromptr, toptr, sizeof(tumbler)); */
00538     movetumbler(fromptr, toptr);
00539 }

bool tumblereq Tumbler a,
Tumbler b
 

???

(to be defined)

Definition at line 101 of file tumble.cxx.

Referenced by checkforopen(), crumqualifies2d(), dumpgranfwids(), fetchorglgr(), findnextnlinksfromtothreesp(), incrementopen(), intersectlinksets(), isaexistsgr(), isanextensionnd(), isinlinklist(), lockeq(), logbertmodified(), main(), onlinklist(), removefromopen(), showgranwids(), sporglset2vspanset(), strongsub(), tumblersub(), and weaksub().

00104 {
00105     char *aptr = (char *)a;    /* char * for cheating in compare loop */
00106     char *bptr = (char *)b;
00107     int i;
00108 
00109 /* return (tumblercmp (aptr, bptr) == EQUAL);// old safe & slow// */
00110 /* could speed up by doing comparison directly or stealing from abscmp */
00111     i = (int)aptr + sizeof(Tumbler);
00112     for (; ((int)aptr) < i;) {
00113         if (*aptr++ != *bptr++)
00114             return false;
00115     }
00116     return true;
00117 }

void tumblerincrement Tumbler aptr,
int  rightshift,
int  bint,
Tumbler cptr
 

???

(to be defined)

Definition at line 880 of file tumble.cxx.

References assert, dumptumbler(), Tumbler::exp, iszerotumbler, L, Tumbler::mantissa, movetumbler, NPLACES, tumblerclear, and tumblerjustify().

Referenced by context2span(), context2vtext(), fillupcbcseq(), findaddressofsecondcutforinsert(), finddocscontainingsp(), findisatoinsertmolecule(), findisatoinsertnonmolecule(), findlastisaincbcgr(), findnextlinkvsa(), findvsatoappend(), insertpm(), inserttextgr(), link2sporglset(), setlinkvsas(), and tumbler2spanset().

00885 {
00886     int idx;
00887 
00888     if (iszerotumbler(aptr)) {
00889         tumblerclear(cptr);
00890         cptr->exp = -rightshift;
00891         cptr->mantissa[0] = bint;
00892         return;
00893     }
00894 
00895     if (aptr != cptr)
00896         movetumbler(aptr, cptr);
00897 
00898     for (idx = NPLACES; aptr->mantissa[--idx] == 0 && idx > 0;)
00899         ;
00900 
00901     if (idx + rightshift >= NPLACES) {
00902 #ifndef DISTRIBUTION
00903         dumptumbler(aptr);
00904         L(" idx = %d  rightshift = %d\n", idx, rightshift);
00905         assert(0); // tumblerincrement overflow
00906 #else
00907         assert(0);
00908 #endif
00909     }
00910 
00911     cptr->mantissa[idx + rightshift] += bint;
00912     tumblerjustify(cptr);
00913 }

int tumblerintdiff Tumbler aptr,
Tumbler bptr
 

???

(to be defined)

Definition at line 862 of file tumble.cxx.

References Tumbler::mantissa, and tumblersub().

Referenced by context2span(), context2vtext(), findaddressofsecondcutforinsert(), and insertpm().

00865 {
00866     Tumbler c;
00867 
00868     tumblersub(aptr, bptr, &c);
00869     return c.mantissa[0];
00870 }

void tumblerjustify Tumbler tumblerptr  ) 
 

???

(to be defined)

Definition at line 465 of file tumble.cxx.

References Tumbler::exp, Tumbler::mantissa, NPLACES, Tumbler::sign, and tdigit.

Referenced by beheadtumbler(), findisatoinsertgr(), insertspanf(), retrievevspansetpm(), slicecbcpm(), tumblerincrement(), tumblersub(), and tumblertruncate().

00467 {
00468     int i, j;
00469     int shift;
00470     tdigit *mantissaptr;
00471 
00472     mantissaptr = tumblerptr->mantissa;
00473     if (mantissaptr[0] != 0)
00474         return;
00475 
00476     for (shift = 0; mantissaptr[shift] == 0; ++shift) {
00477         if (shift == NPLACES - 1) {
00478             tumblerptr->exp = 0;
00479             tumblerptr->sign = 0;
00480             return;
00481         }
00482     }
00483 
00484     for (i = 0, j = shift; j < NPLACES;)
00485         mantissaptr[i++] = mantissaptr[j++];
00486 
00487     while (i < NPLACES)
00488         mantissaptr[i++] = 0;
00489 
00490     tumblerptr->exp -= shift;
00491 
00492     //assert( tumblercheck(tumblerptr) );
00493 }

int tumblerlength Tumbler tumblerptr  ) 
 

???

(to be defined)

Definition at line 428 of file tumble.cxx.

References Tumbler::exp, and nstories().

Referenced by findisatoinsertmolecule(), findisatoinsertnonmolecule(), insertpm(), slicecbcpm(), tumbler2spanset(), and tumblerfixedtoptr().

00430 {
00431     return nstories(tumblerptr) - tumblerptr->exp;
00432 }

void tumblermax Tumbler aptr,
Tumbler bptr,
Tumbler cptr
 

???

(to be defined)

Definition at line 552 of file tumble.cxx.

References GREATER, movetumbler, and tumblercmp().

Referenced by findnextaddressinvspace(), and maxtextwid().

00556 {
00557     if (tumblercmp(aptr, bptr) == GREATER)
00558         movetumbler(aptr, cptr);
00559     else
00560         movetumbler(bptr, cptr);
00561 }

void tumblersub Tumbler aptr,
Tumbler bptr,
Tumbler cptr
 

???

(to be defined)

Definition at line 620 of file tumble.cxx.

References iszerotumbler, movetumbler, Tumbler::sign, tumbleradd, tumblerclear, tumblereq(), and tumblerjustify().

Referenced by context2span(), deletend(), insertseq(), inserttextgr(), locksubtract(), makeoffsetsfor3or4cuts(), makeroomonleftnd(), makespanpairsforispan(), putvspaninlist(), slicecbcpm(), spanintersection(), and tumblerintdiff().

00624 {
00625     Tumbler temp;
00626 
00627 /* 
00628  * if(aptr->sign || bptr->sign) { L("TUMBLERSUB NEG IN \n");
00629  * dumptumbler(aptr); L(" "); dumptumbler(bptr);
00630  * L("\n"); } */
00631     if (iszerotumbler(bptr))
00632         movetumbler(aptr, cptr);
00633 
00634     else if (tumblereq(aptr, bptr))
00635         tumblerclear(cptr);
00636 
00637     else if (iszerotumbler(aptr)) {
00638         movetumbler(bptr, cptr);
00639         cptr->sign = !cptr->sign;
00640 
00641     } else {
00642         movetumbler(bptr, &temp);
00643         temp.sign = !temp.sign;
00644         tumbleradd(aptr, &temp, cptr);
00645     }
00646     tumblerjustify(cptr);
00647 /* tumblercheck (cptr); */
00648 /* 
00649  * if (cptr->sign) { L("TUMBLERSUB NEGATIVE OUTPUT\n");
00650  * dumptumbler(cptr); L("\n"); } */
00651 
00652 }

void tumblertruncate Tumbler aptr,
int  bint,
Tumbler cptr
 

???

(to be defined)

Definition at line 923 of file tumble.cxx.

References Tumbler::exp, Tumbler::mantissa, movetumbler, NPLACES, tumblerclear, and tumblerjustify().

Referenced by findisatoinsertnonmolecule().

00927 {
00928     Tumbler answer;
00929     int i;
00930 
00931     movetumbler(aptr, &answer);
00932     for (i = answer.exp; i < 0 && bint > 0; ++i, --bint)
00933         ;
00934 
00935     if (bint <= 0)
00936         tumblerclear(&answer);
00937     else
00938         for (; bint < NPLACES; ++bint)
00939             answer.mantissa[bint] = 0;
00940 
00941     tumblerjustify(&answer);
00942     movetumbler(&answer, cptr);
00943 }

void weaksub Tumbler aptr,
Tumbler bptr,
Tumbler cptr
 

???

(to be defined)

Definition at line 824 of file tumble.cxx.

References Tumbler::exp, Tumbler::mantissa, movetumbler, NPLACES, tumblerclear, and tumblereq().

Referenced by functiontumbleradd().

00828 {
00829     Tumbler answer;
00830     int i;
00831     int expdiff;
00832 
00833     tumblerclear(&answer);
00834     if (tumblereq(aptr, bptr)) {
00835         movetumbler(&answer, cptr);
00836         return;
00837     }
00838 
00839     answer.exp = aptr->exp;
00840     expdiff = aptr->exp - bptr->exp;
00841 
00842     for (i = 0; i < expdiff; ++i) {
00843         answer.mantissa[i] = aptr->mantissa[i];
00844         if (i >= NPLACES) {
00845             movetumbler(&answer, cptr);
00846             return;
00847         }
00848     }
00849 
00850     answer.mantissa[i] = aptr->mantissa[i] - bptr->mantissa[0];
00851     movetumbler(&answer, cptr);
00852 }


Variable Documentation

Tumbler ZEROTUMBLERvar
 

Definition at line 87 of file tumble.cxx.

Referenced by initsession().


Generated on Sun Aug 21 04:18:39 2005 for Udanax-Green by doxygen1.3.4