mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-01-30 15:32:58 +00:00
Remove test-case for all-zero
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
parent
880a6b34c2
commit
678e63007c
@ -319,27 +319,17 @@ void mpi_core_clz(int lz, int tz)
|
||||
}
|
||||
|
||||
mbedtls_mpi_uint x;
|
||||
size_t expected;
|
||||
|
||||
// generate x with lz leading zeros and tz trailing zeros, all other bits set.
|
||||
if (lz == -1) {
|
||||
// special case: all zero
|
||||
x = 0;
|
||||
expected = sizeof(mbedtls_mpi_uint) * 8;
|
||||
if ((lz + tz) > 0) {
|
||||
// some zero bits
|
||||
uint32_t s = (sizeof(mbedtls_mpi_uint) * 8 - lz - tz);
|
||||
x = ((((mbedtls_mpi_uint) 1) << s) - 1) << tz;
|
||||
} else {
|
||||
expected = lz;
|
||||
if ((lz + tz) > 0) {
|
||||
// some zero bits
|
||||
uint32_t s = (sizeof(mbedtls_mpi_uint) * 8 - lz - tz);
|
||||
x = ((((mbedtls_mpi_uint) 1) << s) - 1) << tz;
|
||||
} else {
|
||||
// all bits set
|
||||
x = ~((mbedtls_mpi_uint) 0);
|
||||
}
|
||||
// all bits set
|
||||
x = ~((mbedtls_mpi_uint) 0);
|
||||
}
|
||||
|
||||
size_t n = mbedtls_mpi_core_clz(x);
|
||||
TEST_EQUAL(n, expected);
|
||||
TEST_EQUAL(n, lz);
|
||||
exit:
|
||||
;
|
||||
}
|
||||
|
@ -494,9 +494,6 @@ mpi_core_fill_random:42:0:-5:0:MBEDTLS_ERR_MPI_BAD_INPUT_DATA
|
||||
CLZ: 0 0: all ones
|
||||
mpi_core_clz:0:0
|
||||
|
||||
CLZ: -1 -1: all zeros
|
||||
mpi_core_clz:-1:-1
|
||||
|
||||
CLZ: 1 0
|
||||
mpi_core_clz:1:0
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user