Support for fast squaring.
This commit is contained in:
@@ -12,7 +12,8 @@ testTypes = [("addition", addTest),
|
||||
("modadd", modaddTest),
|
||||
("subtraction", subTest),
|
||||
("multiplication", mulTest),
|
||||
("expandingmul", expmulTest)
|
||||
("expandingmul", expmulTest),
|
||||
("squaring", squareTest)
|
||||
]
|
||||
|
||||
bitSizes :: [Int]
|
||||
@@ -94,6 +95,15 @@ expmulTest bitsize gen0 = (res, gen2)
|
||||
("b", showHex b' ""),
|
||||
("c", showHex c "")]
|
||||
|
||||
squareTest :: Int -> StdGen -> (Map String String, StdGen)
|
||||
squareTest bitsize gen0 = (res, gen1)
|
||||
where
|
||||
(a, gen1) = random gen0
|
||||
a' = a .&. mask bitsize
|
||||
r = a' * a'
|
||||
res = Map.fromList [("a", showHex a' ""),
|
||||
("r", showHex r "")]
|
||||
|
||||
log :: String -> IO ()
|
||||
log str =
|
||||
do putStr str
|
||||
|
||||
2000
tests/math/squaringU1024.test
Normal file
2000
tests/math/squaringU1024.test
Normal file
File diff suppressed because it is too large
Load Diff
2000
tests/math/squaringU15360.test
Normal file
2000
tests/math/squaringU15360.test
Normal file
File diff suppressed because one or more lines are too long
2000
tests/math/squaringU192.test
Normal file
2000
tests/math/squaringU192.test
Normal file
File diff suppressed because it is too large
Load Diff
2000
tests/math/squaringU2048.test
Normal file
2000
tests/math/squaringU2048.test
Normal file
File diff suppressed because it is too large
Load Diff
2000
tests/math/squaringU256.test
Normal file
2000
tests/math/squaringU256.test
Normal file
File diff suppressed because it is too large
Load Diff
2000
tests/math/squaringU3072.test
Normal file
2000
tests/math/squaringU3072.test
Normal file
File diff suppressed because it is too large
Load Diff
2000
tests/math/squaringU384.test
Normal file
2000
tests/math/squaringU384.test
Normal file
File diff suppressed because it is too large
Load Diff
2000
tests/math/squaringU4096.test
Normal file
2000
tests/math/squaringU4096.test
Normal file
File diff suppressed because it is too large
Load Diff
2000
tests/math/squaringU512.test
Normal file
2000
tests/math/squaringU512.test
Normal file
File diff suppressed because it is too large
Load Diff
2000
tests/math/squaringU576.test
Normal file
2000
tests/math/squaringU576.test
Normal file
File diff suppressed because it is too large
Load Diff
2000
tests/math/squaringU8192.test
Normal file
2000
tests/math/squaringU8192.test
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user