mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-25 01:55:31 +00:00
Add do-while protection to macros
missed do-while around function-like macros (UINT32_BE and UINT_LE macros) originally present in the indivdual files, before being moved to common.h. Signed-off-by: Joe Subbiani <joe.subbiani@arm.com>
This commit is contained in:
parent
4fb755592c
commit
e4cc8c1ee0
|
@ -72,22 +72,22 @@
|
||||||
*/
|
*/
|
||||||
#ifndef GET_UINT32_BE
|
#ifndef GET_UINT32_BE
|
||||||
#define GET_UINT32_BE(n,b,i) \
|
#define GET_UINT32_BE(n,b,i) \
|
||||||
{ \
|
do { \
|
||||||
(n) = ( (uint32_t) (b)[(i) ] << 24 ) \
|
(n) = ( (uint32_t) (b)[(i) ] << 24 ) \
|
||||||
| ( (uint32_t) (b)[(i) + 1] << 16 ) \
|
| ( (uint32_t) (b)[(i) + 1] << 16 ) \
|
||||||
| ( (uint32_t) (b)[(i) + 2] << 8 ) \
|
| ( (uint32_t) (b)[(i) + 2] << 8 ) \
|
||||||
| ( (uint32_t) (b)[(i) + 3] ); \
|
| ( (uint32_t) (b)[(i) + 3] ); \
|
||||||
}
|
} while( 0 )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef PUT_UINT32_BE
|
#ifndef PUT_UINT32_BE
|
||||||
#define PUT_UINT32_BE(n,b,i) \
|
#define PUT_UINT32_BE(n,b,i) \
|
||||||
{ \
|
do { \
|
||||||
(b)[(i) ] = (unsigned char) ( (n) >> 24 ); \
|
(b)[(i) ] = (unsigned char) ( (n) >> 24 ); \
|
||||||
(b)[(i) + 1] = (unsigned char) ( (n) >> 16 ); \
|
(b)[(i) + 1] = (unsigned char) ( (n) >> 16 ); \
|
||||||
(b)[(i) + 2] = (unsigned char) ( (n) >> 8 ); \
|
(b)[(i) + 2] = (unsigned char) ( (n) >> 8 ); \
|
||||||
(b)[(i) + 3] = (unsigned char) ( (n) ); \
|
(b)[(i) + 3] = (unsigned char) ( (n) ); \
|
||||||
}
|
} while( 0 )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -95,22 +95,22 @@
|
||||||
*/
|
*/
|
||||||
#ifndef GET_UINT32_LE
|
#ifndef GET_UINT32_LE
|
||||||
#define GET_UINT32_LE(n,b,i) \
|
#define GET_UINT32_LE(n,b,i) \
|
||||||
{ \
|
do { \
|
||||||
(n) = ( (uint32_t) (b)[(i) ] ) \
|
(n) = ( (uint32_t) (b)[(i) ] ) \
|
||||||
| ( (uint32_t) (b)[(i) + 1] << 8 ) \
|
| ( (uint32_t) (b)[(i) + 1] << 8 ) \
|
||||||
| ( (uint32_t) (b)[(i) + 2] << 16 ) \
|
| ( (uint32_t) (b)[(i) + 2] << 16 ) \
|
||||||
| ( (uint32_t) (b)[(i) + 3] << 24 ); \
|
| ( (uint32_t) (b)[(i) + 3] << 24 ); \
|
||||||
}
|
} while( 0 )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef PUT_UINT32_LE
|
#ifndef PUT_UINT32_LE
|
||||||
#define PUT_UINT32_LE(n,b,i) \
|
#define PUT_UINT32_LE(n,b,i) \
|
||||||
{ \
|
do { \
|
||||||
(b)[(i) ] = (unsigned char) ( ( (n) ) & 0xFF ); \
|
(b)[(i) ] = (unsigned char) ( ( (n) ) & 0xFF ); \
|
||||||
(b)[(i) + 1] = (unsigned char) ( ( (n) >> 8 ) & 0xFF ); \
|
(b)[(i) + 1] = (unsigned char) ( ( (n) >> 8 ) & 0xFF ); \
|
||||||
(b)[(i) + 2] = (unsigned char) ( ( (n) >> 16 ) & 0xFF ); \
|
(b)[(i) + 2] = (unsigned char) ( ( (n) >> 16 ) & 0xFF ); \
|
||||||
(b)[(i) + 3] = (unsigned char) ( ( (n) >> 24 ) & 0xFF ); \
|
(b)[(i) + 3] = (unsigned char) ( ( (n) >> 24 ) & 0xFF ); \
|
||||||
}
|
} while( 0 )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue