LargeInteger.st
changeset 5014 fa22b711e749
parent 5008 1a19e0059c54
child 5020 eff43341e72c
equal deleted inserted replaced
5013:e2aff65e6eba 5014:fa22b711e749
  2019             if ((index & 1) == 0) { /* even number of bytes */
  2019             if ((index & 1) == 0) { /* even number of bytes */
  2020                 while (index > 1) {
  2020                 while (index > 1) {
  2021                     unsigned INT t;
  2021                     unsigned INT t;
  2022                     unsigned INT div;
  2022                     unsigned INT div;
  2023 
  2023 
       
  2024                     index -= 2;
  2024 #if defined(__LSBFIRST) || defined(i386)
  2025 #if defined(__LSBFIRST) || defined(i386)
  2025                     index -= 2;
       
  2026                     t = *((unsigned short *)(&digitBytes[index]));
  2026                     t = *((unsigned short *)(&digitBytes[index]));
  2027 # else
  2027 #else
  2028                     index--;
  2028                     t = digitBytes[index+1];
  2029                     t = digitBytes[index];
       
  2030                     index--;
       
  2031                     t = (t << 8) | digitBytes[index];
  2029                     t = (t << 8) | digitBytes[index];
  2032 # endif
  2030 #endif
  2033                     t = t | (rest << 16);
  2031                     t = t | (rest << 16);
  2034                     div = t / divisor;
  2032                     div = t / divisor;
  2035                     rest = t % divisor;
  2033                     rest = t % divisor;
  2036 #if defined(__LSBFIRST) || defined(i386)
  2034 #if defined(__LSBFIRST) || defined(i386)
  2037                     *((unsigned short *)(&resultBytes[index])) = (div & 0xFFFF);
  2035                     *((unsigned short *)(&resultBytes[index])) = (div & 0xFFFF);
  2038 # else
  2036 #else
  2039                     resultBytes[index+1] = div >> 8;
  2037                     resultBytes[index+1] = div >> 8;
  2040                     resultBytes[index] = div /* & 0xFF */;
  2038                     resultBytes[index] = div /* & 0xFF */;
  2041 # endif
  2039 #endif
  2042                 }
  2040                 }
  2043             }
  2041             }
  2044         }
  2042         }
  2045         while (index > 0) {
  2043         while (index > 0) {
  2046             unsigned INT t;
  2044             unsigned INT t;
  4286 ! !
  4284 ! !
  4287 
  4285 
  4288 !LargeInteger class methodsFor:'documentation'!
  4286 !LargeInteger class methodsFor:'documentation'!
  4289 
  4287 
  4290 version
  4288 version
  4291     ^ '$Header: /cvs/stx/stx/libbasic/LargeInteger.st,v 1.149 1999-11-19 08:11:44 stefan Exp $'
  4289     ^ '$Header: /cvs/stx/stx/libbasic/LargeInteger.st,v 1.150 1999-11-22 20:44:47 cg Exp $'
  4292 ! !
  4290 ! !