From 33642e379f7969e7a610669cb230d45a69bc7114 Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Tue, 26 Mar 2002 12:25:10 +0000 Subject: [PATCH] Changed order of macros for documentation. --- lib/silcutil/silctypes.h | 134 +++++++++++++++++++-------------------- 1 file changed, 67 insertions(+), 67 deletions(-) diff --git a/lib/silcutil/silctypes.h b/lib/silcutil/silctypes.h index 21b3abd1..fdb3e73d 100644 --- a/lib/silcutil/silctypes.h +++ b/lib/silcutil/silctypes.h @@ -226,21 +226,40 @@ typedef SilcUInt32 * void *; | ((SilcUInt32)(SilcUInt8)(cp)[1]) /***/ -/****d* silcutil/SILCTypes/SILC_PUT16_MSB +/****d* silcutil/SILCTypes/SILC_GET32_MSB * * NAME * - * #define SILC_PUT16_MSB ... + * #define SILC_GET32_MSB ... * * DESCRIPTION * - * Put two 8-bit bytes, most significant bytes first. + * Return four 8-bit bytes, most significant bytes first. * * SOURCE */ -#define SILC_PUT16_MSB(l, cp) \ - (cp)[0] = l >> 8; \ - (cp)[1] = l; +#define SILC_GET32_MSB(l, cp) \ + (l) = ((SilcUInt32)(SilcUInt8)(cp)[0]) << 24 \ + | ((SilcUInt32)(SilcUInt8)(cp)[1] << 16) \ + | ((SilcUInt32)(SilcUInt8)(cp)[2] << 8) \ + | ((SilcUInt32)(SilcUInt8)(cp)[3]) +/***/ + +/****d* silcutil/SILCTypes/SILC_GET64_MSB + * + * NAME + * + * #define SILC_GET64_MSB ... + * + * DESCRIPTION + * + * Return eight 8-bit bytes, most significant bytes first. + * + * SOURCE + */ +#define SILC_GET64_MSB(l, cp) \ + (l) = ((((SilcUInt64)GET_WORD((cp))) << 32) | \ + ((SilcUInt64)GET_WORD((cp) + 4))) /***/ /****d* silcutil/SILCTypes/SILC_GET16_LSB @@ -260,40 +279,47 @@ typedef SilcUInt32 * void *; | ((SilcUInt32)(SilcUInt8)(cp)[1] << 8) /***/ -/****d* silcutil/SILCTypes/SILC_PUT16_LSB +/****d* silcutil/SILCTypes/SILC_GET32_LSB * * NAME * - * #define SILC_PUT16_LSB ... + * #define SILC_GET32_LSB ... * * DESCRIPTION * - * Put two 8-bit bytes, least significant bytes first. + * Return four 8-bit bytes, least significant bytes first. * * SOURCE */ -#define SILC_PUT16_LSB(l, cp) \ - (cp)[0] = l; \ - (cp)[1] = l >> 8; +#define SILC_GET32_LSB(l, cp) \ + (l) = ((SilcUInt32)(SilcUInt8)(cp)[0]) \ + | ((SilcUInt32)(SilcUInt8)(cp)[1] << 8) \ + | ((SilcUInt32)(SilcUInt8)(cp)[2] << 16) \ + | ((SilcUInt32)(SilcUInt8)(cp)[3] << 24) + +/* Same as upper but XOR the result always. Special purpose macro. */ +#define SILC_GET32_X_LSB(l, cp) \ + (l) ^= ((SilcUInt32)(SilcUInt8)(cp)[0]) \ + | ((SilcUInt32)(SilcUInt8)(cp)[1] << 8) \ + | ((SilcUInt32)(SilcUInt8)(cp)[2] << 16) \ + | ((SilcUInt32)(SilcUInt8)(cp)[3] << 24) /***/ -/****d* silcutil/SILCTypes/SILC_GET32_MSB +/****d* silcutil/SILCTypes/SILC_PUT16_MSB * * NAME * - * #define SILC_GET32_MSB ... + * #define SILC_PUT16_MSB ... * * DESCRIPTION * - * Return four 8-bit bytes, most significant bytes first. + * Put two 8-bit bytes, most significant bytes first. * * SOURCE */ -#define SILC_GET32_MSB(l, cp) \ - (l) = ((SilcUInt32)(SilcUInt8)(cp)[0]) << 24 \ - | ((SilcUInt32)(SilcUInt8)(cp)[1] << 16) \ - | ((SilcUInt32)(SilcUInt8)(cp)[2] << 8) \ - | ((SilcUInt32)(SilcUInt8)(cp)[3]) +#define SILC_PUT16_MSB(l, cp) \ + (cp)[0] = l >> 8; \ + (cp)[1] = l; /***/ /****d* silcutil/SILCTypes/SILC_PUT32_MSB @@ -315,85 +341,59 @@ typedef SilcUInt32 * void *; (cp)[3] = l; /***/ -/****d* silcutil/SILCTypes/SILC_GET32_LSB +/****d* silcutil/SILCTypes/SILC_PUT64_MSB * * NAME * - * #define SILC_GET32_LSB ... + * #define SILC_PUT64_MSB ... * * DESCRIPTION * - * Return four 8-bit bytes, least significant bytes first. + * Put eight 8-bit bytes, most significant bytes first. * * SOURCE */ -#define SILC_GET32_LSB(l, cp) \ - (l) = ((SilcUInt32)(SilcUInt8)(cp)[0]) \ - | ((SilcUInt32)(SilcUInt8)(cp)[1] << 8) \ - | ((SilcUInt32)(SilcUInt8)(cp)[2] << 16) \ - | ((SilcUInt32)(SilcUInt8)(cp)[3] << 24) - -/* Same as upper but XOR the result always. Special purpose macro. */ -#define SILC_GET32_X_LSB(l, cp) \ - (l) ^= ((SilcUInt32)(SilcUInt8)(cp)[0]) \ - | ((SilcUInt32)(SilcUInt8)(cp)[1] << 8) \ - | ((SilcUInt32)(SilcUInt8)(cp)[2] << 16) \ - | ((SilcUInt32)(SilcUInt8)(cp)[3] << 24) +#define SILC_PUT64_MSB(l, cp) \ +do { \ + SILC_PUT32_MSB((SilcUInt32)((SilcUInt64)(l) >> 32), (cp)); \ + SILC_PUT32_MSB((SilcUInt32)(l), (cp) + 4); \ +} while(0) /***/ -/****d* silcutil/SILCTypes/SILC_PUT32_LSB +/****d* silcutil/SILCTypes/SILC_PUT16_LSB * * NAME * - * #define SILC_PUT32_LSB ... + * #define SILC_PUT16_LSB ... * * DESCRIPTION * - * Put four 8-bit bytes, least significant bytes first. + * Put two 8-bit bytes, least significant bytes first. * * SOURCE */ -#define SILC_PUT32_LSB(l, cp) \ +#define SILC_PUT16_LSB(l, cp) \ (cp)[0] = l; \ - (cp)[1] = l >> 8; \ - (cp)[2] = l >> 16; \ - (cp)[3] = l >> 24; -/***/ - -/****d* silcutil/SILCTypes/SILC_GET64_MSB - * - * NAME - * - * #define SILC_GET64_MSB ... - * - * DESCRIPTION - * - * Return eight 8-bit bytes, most significant bytes first. - * - * SOURCE - */ -#define SILC_GET64_MSB(l, cp) \ - (l) = ((((SilcUInt64)GET_WORD((cp))) << 32) | \ - ((SilcUInt64)GET_WORD((cp) + 4))) + (cp)[1] = l >> 8; /***/ -/****d* silcutil/SILCTypes/SILC_PUT64_MSB +/****d* silcutil/SILCTypes/SILC_PUT32_LSB * * NAME * - * #define SILC_PUT64_MSB ... + * #define SILC_PUT32_LSB ... * * DESCRIPTION * - * Put eight 8-bit bytes, most significant bytes first. + * Put four 8-bit bytes, least significant bytes first. * * SOURCE */ -#define SILC_PUT64_MSB(l, cp) \ -do { \ - SILC_PUT32_MSB((SilcUInt32)((SilcUInt64)(l) >> 32), (cp)); \ - SILC_PUT32_MSB((SilcUInt32)(l), (cp) + 4); \ -} while(0) +#define SILC_PUT32_LSB(l, cp) \ + (cp)[0] = l; \ + (cp)[1] = l >> 8; \ + (cp)[2] = l >> 16; \ + (cp)[3] = l >> 24; /***/ #endif /* SILCTYPES_H */ -- 2.24.0