5 Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
7 Copyright (C) 1997 - 2000 Pekka Riikonen
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
24 /* Returns four 8-bit bytes, most significant bytes first. */
25 #define SILC_GET32_MSB(l, cp) \
26 (l) = ((uint32)(uint8)(cp)[0]) << 24 \
27 | ((uint32)(uint8)(cp)[1] << 16) \
28 | ((uint32)(uint8)(cp)[2] << 8) \
29 | ((uint32)(uint8)(cp)[3])
30 #define SILC_PUT32_MSB(l, cp) \
37 /* Returns four 8-bit bytes, less significant bytes first. */
38 #define SILC_GET32_LSB(l, cp) \
39 (l) = ((uint32)(uint8)(cp)[0]) \
40 | ((uint32)(uint8)(cp)[1] << 8) \
41 | ((uint32)(uint8)(cp)[2] << 16) \
42 | ((uint32)(uint8)(cp)[3] << 24)
43 /* same as upper but XOR the result always */
44 #define SILC_GET32_X_LSB(l, cp) \
45 (l) ^= ((uint32)(uint8)(cp)[0]) \
46 | ((uint32)(uint8)(cp)[1] << 8) \
47 | ((uint32)(uint8)(cp)[2] << 16) \
48 | ((uint32)(uint8)(cp)[3] << 24)
49 #define SILC_PUT32_LSB(l, cp) \
56 /* Returns two 8-bit bytes, most significant bytes first. */
57 #define SILC_GET16_MSB(l, cp) \
58 (l) = ((uint32)(uint8)(cp)[0] << 8) \
59 | ((uint32)(uint8)(cp)[1])
60 #define SILC_PUT16_MSB(l, cp) \
64 /* Returns two 8-bit bytes, less significant bytes first. */
65 #define SILC_GET16_LSB(l, cp) \
66 (l) = ((uint32)(uint8)(cp)[0]) \
67 | ((uint32)(uint8)(cp)[1] << 8)
68 #define SILC_PUT16_LSB(l, cp) \