Support for fast squaring.

This commit is contained in:
2018-06-02 20:29:44 -07:00
parent a5f0179d77
commit bebb5b2861
14 changed files with 22103 additions and 1 deletions

View File

@@ -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

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

2000
tests/math/squaringU192.test Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

2000
tests/math/squaringU256.test Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

2000
tests/math/squaringU384.test Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

2000
tests/math/squaringU512.test Normal file

File diff suppressed because it is too large Load Diff

2000
tests/math/squaringU576.test Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff