Import Upstream version 1.8.5
[hcoop/debian/openafs.git] / src / kauth / kaport.h
1 /*
2 * Copyright 2000, International Business Machines Corporation and others.
3 * All Rights Reserved.
4 *
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
8 */
9
10 /*
11 * some macros to permit a couple of new features while remaining compatible
12 * and reasonably portable...
13 * could tighten up 0 and 3 a little, but I've left them like this for now
14 * for ease of understanding.
15 * assumes sizeof(afs_int32) == 4, but then, so does the rest of AFS...
16 */
17 #ifndef KAPORT_H
18 #define KAPORT_H
19
20 #define unpack_long(src, dst) { \
21 dst[0] = ((unsigned char)(((afs_uint32)(src) & 0xff000000) >> 24) & 0xff); \
22 dst[1] = ((unsigned char)(((afs_uint32)(src) & 0x00ff0000) >> 16) & 0xff); \
23 dst[2] = ((unsigned char)(((afs_uint32)(src) & 0x0000ff00) >> 8) & 0xff); \
24 dst[3] = ((unsigned char)(((afs_uint32)(src) & 0x000000ff) >> 0) & 0xff); }
25
26 #define pack_long(src) ( \
27 (afs_uint32) ( \
28 ((afs_uint32) ((src)[0] & 0xff) << 24) | \
29 ((afs_uint32) ((src)[1] & 0xff) << 16) | \
30 ((afs_uint32) ((src)[2] & 0xff) << 8) | \
31 ((afs_uint32) ((src)[3] & 0xff) << 0) ) )
32
33 #endif /* KAPORT_H */