Next: , Previous: , Up: LargePositiveInteger   [Index]


1.100.3 LargePositiveInteger: helper byte-level methods

bytes: byteArray1 from: j compare: byteArray2

Private - Answer the sign of byteArray2 - byteArray1; the j-th byte of byteArray1 is compared with the first of byteArray2, the j+1-th with the second, and so on.

bytes: byteArray1 from: j subtract: byteArray2

Private - Sutract the bytes in byteArray2 from those in byteArray1

bytes: bytes multiply: anInteger

Private - Multiply the bytes in bytes by anInteger, which must be < 255. Put the result back in bytes.

bytesLeftShift: aByteArray

Private - Left shift by 1 place the bytes in aByteArray

bytesLeftShift: aByteArray big: totalShift

Private - Left shift the bytes in aByteArray by totalShift places

bytesLeftShift: aByteArray n: shift

Private - Left shift by shift places the bytes in aByteArray (shift <= 7)

bytesRightShift: aByteArray big: totalShift

Private - Right shift the bytes in aByteArray by totalShift places

bytesRightShift: bytes n: aNumber

Private - Right shift the bytes in ‘bytes’ by ’aNumber’ places (shift <= 7)

bytesTrailingZeros: bytes

Private - Answer the number of trailing zero bits in the receiver

primDivide: rhs

Private - Implements Knuth’s divide and correct algorithm from ‘Seminumerical Algorithms’ 3rd Edition, section 4.3.1 (which is basically an enhanced version of the divide ‘algorithm’ for two-digit divisors which is taught in primary school!!!)