Remove test-case for all-zero

Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
Dave Rodgman 2023-04-20 12:28:59 +01:00
parent 880a6b34c2
commit 678e63007c
2 changed files with 7 additions and 20 deletions

View File

@ -319,15 +319,6 @@ void mpi_core_clz(int lz, int tz)
} }
mbedtls_mpi_uint x; 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;
} else {
expected = lz;
if ((lz + tz) > 0) { if ((lz + tz) > 0) {
// some zero bits // some zero bits
uint32_t s = (sizeof(mbedtls_mpi_uint) * 8 - lz - tz); uint32_t s = (sizeof(mbedtls_mpi_uint) * 8 - lz - tz);
@ -336,10 +327,9 @@ void mpi_core_clz(int lz, int tz)
// all bits set // all bits set
x = ~((mbedtls_mpi_uint) 0); x = ~((mbedtls_mpi_uint) 0);
} }
}
size_t n = mbedtls_mpi_core_clz(x); size_t n = mbedtls_mpi_core_clz(x);
TEST_EQUAL(n, expected); TEST_EQUAL(n, lz);
exit: exit:
; ;
} }

View File

@ -494,9 +494,6 @@ mpi_core_fill_random:42:0:-5:0:MBEDTLS_ERR_MPI_BAD_INPUT_DATA
CLZ: 0 0: all ones CLZ: 0 0: all ones
mpi_core_clz:0:0 mpi_core_clz:0:0
CLZ: -1 -1: all zeros
mpi_core_clz:-1:-1
CLZ: 1 0 CLZ: 1 0
mpi_core_clz:1:0 mpi_core_clz:1:0