Large integers

Bob Arning arning at charm.net
Thu Aug 3 17:06:18 UTC 2000


On Thu, 3 Aug 2000 12:53:26 -0400 (EDT) Jesse Welton <jwelton at pacific.mps.ohio-state.edu> wrote:
>Er, actually, I see what you mean.  That doesn't change the results
>much for really large integers.  I see a significant increase in speed
>by changing \\ to \\\.  What cases doesn't \\\ handle, that \\ does?

#\\\ will take you directly to the LargeInteger plugin which is optimized for this kind of stuff. Sending #\\ to a LargeInteger will often fail the primitive:

Take the receiver modulo the argument. The result is the
	remainder rounded towards negative infinity, of the receiver divided
	by the argument. Fail if the argument is 0. Fail if either the argument
	or the result is not a SmallInteger or a LargePositiveInteger less than
	2-to-the-30th (1073741824).

and take you to the super method:

	^self - (self // aNumber * aNumber)

which will be slower. Note that #\\\ is only suitable for positive numbers which. I think, is all one cares about in DSA, RSA, etc.

Cheers,
Bob





More information about the Squeak-dev mailing list