mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-01 22:20:58 +00:00
Move macros to come before function declarations
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
This commit is contained in:
parent
630110ab23
commit
5eefc3db3f
@ -31,6 +31,20 @@
|
|||||||
#include "mbedtls/bignum.h"
|
#include "mbedtls/bignum.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define ciL ( sizeof(mbedtls_mpi_uint) ) /* chars in limb */
|
||||||
|
#define biL ( ciL << 3 ) /* bits in limb */
|
||||||
|
#define biH ( ciL << 2 ) /* half limb size */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Convert between bits/chars and number of limbs
|
||||||
|
* Divide first in order to avoid potential overflows
|
||||||
|
*/
|
||||||
|
#define BITS_TO_LIMBS(i) ( (i) / biL + ( (i) % biL != 0 ) )
|
||||||
|
#define CHARS_TO_LIMBS(i) ( (i) / ciL + ( (i) % ciL != 0 ) )
|
||||||
|
/* Get a specific byte, without range checks. */
|
||||||
|
#define GET_BYTE( X, i ) \
|
||||||
|
( ( (X)[(i) / ciL] >> ( ( (i) % ciL ) * 8 ) ) & 0xff )
|
||||||
|
|
||||||
/** Count leading zero bits in a given integer.
|
/** Count leading zero bits in a given integer.
|
||||||
*
|
*
|
||||||
* \param a Integer to count leading zero bits.
|
* \param a Integer to count leading zero bits.
|
||||||
@ -141,20 +155,6 @@ int mbedtls_mpi_core_write_be( const mbedtls_mpi_uint *A,
|
|||||||
unsigned char *output,
|
unsigned char *output,
|
||||||
size_t output_length );
|
size_t output_length );
|
||||||
|
|
||||||
#define ciL ( sizeof(mbedtls_mpi_uint) ) /* chars in limb */
|
|
||||||
#define biL ( ciL << 3 ) /* bits in limb */
|
|
||||||
#define biH ( ciL << 2 ) /* half limb size */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Convert between bits/chars and number of limbs
|
|
||||||
* Divide first in order to avoid potential overflows
|
|
||||||
*/
|
|
||||||
#define BITS_TO_LIMBS(i) ( (i) / biL + ( (i) % biL != 0 ) )
|
|
||||||
#define CHARS_TO_LIMBS(i) ( (i) / ciL + ( (i) % ciL != 0 ) )
|
|
||||||
/* Get a specific byte, without range checks. */
|
|
||||||
#define GET_BYTE( X, i ) \
|
|
||||||
( ( (X)[(i) / ciL] >> ( ( (i) % ciL ) * 8 ) ) & 0xff )
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Conditional addition of two known-size large unsigned integers,
|
* \brief Conditional addition of two known-size large unsigned integers,
|
||||||
* returning the carry.
|
* returning the carry.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user