Create a structure for large integers
- A structure of minimal size to process numbers speeds up any routines that act on the structures, E.G., zeroing all elements. Base 2 digits are approximately 3 times the number of base 10 digits for the same value.The examples for this struct in binary, but any base is posssible.
- struct
- long start;
- long stop;
- char digit[gMaxTab];
- The digit value is only '0' or '1' the binary representation is processed as a string.
- start contains the offset value for the high order digit in the digit array.
- stop contains the offset value for the low order digit in the digit array.
- The reason for start and stop is to speed up processing in areas like dividing by a power of 2. It is easily accomplished by subtracting only from the stop field.
- A struct with an array twice the size of the original struct is also desirable for doing circular shifts.
The shift, in either direction, is accomplished by extracting the single, either high or low order, digit that is shifted. The start and stop bit is then adjusted, and the extracted bit placed in the new location. Circular Shift
Last updated: 4/18/2002
Webmaster: Ulrich (Ulie) Sondermann usondermann@earthlink.net
© copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002