The Trunk: KernelTests-nice.245.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: KernelTests-nice.245.mcz

commits-2
Nicolas Cellier uploaded a new version of KernelTests to project The Trunk:
http://source.squeak.org/trunk/KernelTests-nice.245.mcz

==================== Summary ====================

Name: KernelTests-nice.245
Author: nice
Time: 24 February 2013, 5:34:23.518 pm
UUID: 2a95d1b1-1e90-45e5-9b95-7f5e8a7cf92f
Ancestors: KernelTests-nice.244

Reduce the number of hardcoded constants used by #raisedTo:modulo: tests too.

=============== Diff against KernelTests-nice.244 ===============

Item was changed:
  ----- Method: IntegerTest>>testMontgomeryMultiplication (in category 'testing - arithmetic') -----
  testMontgomeryMultiplication
  | a m mInv |
  m := 15485863.
+ mInv := m montgomeryDigitBase - ((m bitAnd: m montgomeryDigitMax) reciprocalModulo: m montgomeryDigitBase).
+ a := (m montgomeryDigitBase raisedTo: m montgomeryNumberOfDigits) \\ m.
- mInv := 256 - ((m bitAnd: 255) reciprocalModulo: 256).
- a := (256 raisedTo: m digitLength) \\ m.
  #(483933 3871465 8951195) do: [:s |
  (s montgomeryTimes: a modulo: m mInvModB: mInv) ifNotNil: [:s1 |
  | s2 sa ssa |
  self assert: s = s1.
  sa := s montgomeryTimes: (a * a \\ m) modulo: m mInvModB: mInv.
  self assert: sa = (s * a \\ m).
  ssa := sa montgomeryTimes: sa modulo: m mInvModB: mInv.
  self assert: ssa = (s * s * a \\ m).
  s2 := ssa montgomeryTimes: 1 modulo: m mInvModB: mInv.
  self assert: s2 = (s * s \\ m)]].!