mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-26 15:55:50 +01:00
Fix for compiler warnings and style
Changes for C90 compliance, and style following review
This commit is contained in:
parent
c42350125e
commit
f5ba04541e
@ -1212,21 +1212,27 @@ int mbedtls_mpi_mul_int( mbedtls_mpi *X, const mbedtls_mpi *A, mbedtls_mpi_uint
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Unsigned integer divide - 64bit dividend and 32bit divisor
|
* Unsigned integer divide - double mbedtls_mpi_uint dividend, u1/u0, and
|
||||||
|
* mbedtls_mpi_uint divisor, d
|
||||||
*/
|
*/
|
||||||
static mbedtls_mpi_uint mbedtls_int_div_int( mbedtls_mpi_uint u1,
|
static mbedtls_mpi_uint mbedtls_int_div_int( mbedtls_mpi_uint u1,
|
||||||
mbedtls_mpi_uint u0, mbedtls_mpi_uint d, mbedtls_mpi_uint *r )
|
mbedtls_mpi_uint u0, mbedtls_mpi_uint d, mbedtls_mpi_uint *r )
|
||||||
{
|
{
|
||||||
#if defined(MBEDTLS_HAVE_UDBL)
|
#if defined(MBEDTLS_HAVE_UDBL)
|
||||||
mbedtls_t_udbl dividend, quotient;
|
mbedtls_t_udbl dividend, quotient;
|
||||||
|
#else
|
||||||
|
const mbedtls_mpi_uint radix = 1 << biH;
|
||||||
|
mbedtls_mpi_uint d0, d1, q0, q1, rAX, r0, quotient;
|
||||||
|
mbedtls_mpi_uint u0_msw, u0_lsw;
|
||||||
|
int s;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check for overflow
|
* Check for overflow
|
||||||
*/
|
*/
|
||||||
if(( 0 == d ) || ( u1 >= d ))
|
if( 0 == d || u1 >= d )
|
||||||
{
|
{
|
||||||
if (r != NULL) *r = (~0);
|
if (r != NULL) *r = ~0;
|
||||||
|
|
||||||
return ( ~0 );
|
return ( ~0 );
|
||||||
}
|
}
|
||||||
@ -1243,10 +1249,6 @@ static mbedtls_mpi_uint mbedtls_int_div_int(mbedtls_mpi_uint u1,
|
|||||||
|
|
||||||
return (mbedtls_mpi_uint) quotient;
|
return (mbedtls_mpi_uint) quotient;
|
||||||
#else
|
#else
|
||||||
const mbedtls_mpi_uint radix = 1 << biH;
|
|
||||||
mbedtls_mpi_uint d0, d1, q0, q1, rAX, r0, quotient;
|
|
||||||
mbedtls_mpi_uint u0_msw, u0_lsw;
|
|
||||||
int s;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Algorithm D, Section 4.3.1 - The Art of Computer Programming
|
* Algorithm D, Section 4.3.1 - The Art of Computer Programming
|
||||||
@ -1260,7 +1262,7 @@ static mbedtls_mpi_uint mbedtls_int_div_int(mbedtls_mpi_uint u1,
|
|||||||
d = d << s;
|
d = d << s;
|
||||||
|
|
||||||
u1 = u1 << s;
|
u1 = u1 << s;
|
||||||
u1 |= (u0 >> (32 - s)) & ( (-s) >> 31);
|
u1 |= ( u0 >> ( 32 - s ) ) & ( -s >> 31 );
|
||||||
u0 = u0 << s;
|
u0 = u0 << s;
|
||||||
|
|
||||||
d1 = d >> biH;
|
d1 = d >> biH;
|
||||||
|
Loading…
Reference in New Issue
Block a user