mirror of
https://github.com/ipxe/ipxe
synced 2025-12-10 13:32:20 +03:00
[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>
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user