aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2024-01-19 16:35:02 +0000
committerMichael Brown <mcb30@ipxe.org>2024-01-19 16:40:11 +0000
commit908174ec7e49d845c8b52a07a3db32534eade37d (patch)
tree629f597d76156716b292a1b96c30672d999d260c /src/tests
parentbac13ba1f658a1e742b9ceb958e670086affebe7 (diff)
downloadipxe-908174ec7e49d845c8b52a07a3db32534eade37d.tar.gz
[loong64] Replace broken big integer arithmetic implementations
The slightly incomprehensible LoongArch64 implementation for bigint_subtract() is observed to produce incorrect results for some input values. Replace the suspicious LoongArch64 implementations of bigint_add(), bigint_subtract(), bigint_rol() and bigint_ror(), and add a test case for a subtraction that was producing an incorrect result with the previous implementation. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/bigint_test.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/tests/bigint_test.c b/src/tests/bigint_test.c
index f09d7c76a..76aca1059 100644
--- a/src/tests/bigint_test.c
+++ b/src/tests/bigint_test.c
@@ -714,6 +714,15 @@ static void bigint_test_exec ( void ) {
bigint_subtract_ok ( BIGINT ( 0xbb, 0x77, 0x32, 0x5a ),
BIGINT ( 0x5a, 0xd5, 0xfe, 0x28 ),
BIGINT ( 0x9f, 0x5e, 0xcb, 0xce ) );
+ bigint_subtract_ok ( BIGINT ( 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff ),
+ BIGINT ( 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a ),
+ BIGINT ( 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b ) );
bigint_subtract_ok ( BIGINT ( 0x7b, 0xaa, 0x16, 0xcf, 0x15, 0x87,
0xe0, 0x4f, 0x2c, 0xa3, 0xec, 0x2f,
0x46, 0xfb, 0x83, 0xc6, 0xe0, 0xee,