Commit ffcdc8c6 authored by Simon Josefsson's avatar Simon Josefsson Committed by Niels Möller

(LE_READ_UINT16, LE_WRITE_UINT16): New macros.

Rev: src/nettle/macros.h:1.7
parent deed722a
......@@ -78,6 +78,17 @@ do { \
(p)[0] = (i) & 0xff; \
} while(0)
/* Analogous macros, for 16 bit numbers */
#define LE_READ_UINT16(p) \
( (((uint32_t) (p)[1]) << 8) \
| ((uint32_t) (p)[0]))
#define LE_WRITE_UINT16(p, i) \
do { \
(p)[1] = ((i) >> 8) & 0xff; \
(p)[0] = (i) & 0xff; \
} while(0)
/* Macro to make it easier to loop over several blocks. */
#define FOR_BLOCKS(length, dst, src, blocksize) \
assert( !((length) % (blocksize))); \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment