diff options
author | José M. Guisado <guigom@riseup.net> | 2019-09-18 12:30:28 +0200 |
---|---|---|
committer | José M. Guisado <guigom@riseup.net> | 2019-10-27 10:27:54 +0100 |
commit | f237529fff657bbbf8d2f2632337d9848446d7da (patch) | |
tree | f850a8ec3c5445b9489108a9d358cc71a3326508 /src/test/test_util.c | |
parent | 7225cfc58671aaaeb2e17e7e46bc1f33b87ab22a (diff) | |
download | tor-f237529fff657bbbf8d2f2632337d9848446d7da.tar.gz tor-f237529fff657bbbf8d2f2632337d9848446d7da.zip |
Add nowrap u64 multiplication function
Follows #30920
Signed-off-by: José M. Guisado <guigom@riseup.net>
Diffstat (limited to 'src/test/test_util.c')
-rw-r--r-- | src/test/test_util.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/test/test_util.c b/src/test/test_util.c index 84834f4d6c..90e1b080b1 100644 --- a/src/test/test_util.c +++ b/src/test/test_util.c @@ -33,6 +33,7 @@ #include "lib/process/env.h" #include "lib/process/pidfile.h" #include "lib/intmath/weakrng.h" +#include "lib/intmath/muldiv.h" #include "lib/thread/numcpus.h" #include "lib/math/fp.h" #include "lib/math/laplace.h" @@ -5973,6 +5974,14 @@ test_util_nowrap_math(void *arg) tt_u64_op(UINT32_MAX, OP_EQ, tor_add_u32_nowrap(2, UINT32_MAX-1)); tt_u64_op(UINT32_MAX, OP_EQ, tor_add_u32_nowrap(UINT32_MAX, UINT32_MAX)); + tt_u64_op(0, OP_EQ, tor_mul_u64_nowrap(0, 0)); + tt_u64_op(1, OP_EQ, tor_mul_u64_nowrap(1, 1)); + tt_u64_op(2, OP_EQ, tor_mul_u64_nowrap(2, 1)); + tt_u64_op(4, OP_EQ, tor_mul_u64_nowrap(2, 2)); + tt_u64_op(UINT64_MAX, OP_EQ, tor_mul_u64_nowrap(UINT64_MAX, 1)); + tt_u64_op(UINT64_MAX, OP_EQ, tor_mul_u64_nowrap(2, UINT64_MAX)); + tt_u64_op(UINT64_MAX, OP_EQ, tor_mul_u64_nowrap(UINT64_MAX, UINT64_MAX)); + done: ; } |