OpenAFS
OpenAFS distributed network file system
|
00001 /* 00002 * Copyright 2000, International Business Machines Corporation and others. 00003 * All Rights Reserved. 00004 * 00005 * This software has been released under the terms of the IBM Public 00006 * License. For details, see the LICENSE file in the top-level source 00007 * directory or online at http://www.openafs.org/dl/license10.html 00008 */ 00009 00010 /* 00011 * some macros to permit a couple of new features while remaining compatible 00012 * and reasonably portable... 00013 * could tighten up 0 and 3 a little, but I've left them like this for now 00014 * for ease of understanding. 00015 * assumes sizeof(afs_int32) == 4, but then, so does the rest of AFS... 00016 */ 00017 #ifndef KAPORT_H 00018 #define KAPORT_H 00019 00020 #define unpack_long(src, dst) { \ 00021 dst[0] = ((unsigned char)(((afs_uint32)(src) & 0xff000000) >> 24) & 0xff); \ 00022 dst[1] = ((unsigned char)(((afs_uint32)(src) & 0x00ff0000) >> 16) & 0xff); \ 00023 dst[2] = ((unsigned char)(((afs_uint32)(src) & 0x0000ff00) >> 8) & 0xff); \ 00024 dst[3] = ((unsigned char)(((afs_uint32)(src) & 0x000000ff) >> 0) & 0xff); } 00025 00026 #define pack_long(src) ( \ 00027 (afs_uint32) ( \ 00028 ((afs_uint32) ((src)[0] & 0xff) << 24) | \ 00029 ((afs_uint32) ((src)[1] & 0xff) << 16) | \ 00030 ((afs_uint32) ((src)[2] & 0xff) << 8) | \ 00031 ((afs_uint32) ((src)[3] & 0xff) << 0) ) ) 00032 00033 #endif /* KAPORT_H */