2 * Copyright (C) James R. Leu 2003
5 * This software is covered under the LGPL, for more
6 * info check out http://www.gnu.org/copyleft/lgpl.html
9 #ifndef MPLS_BITFIELD_H
10 #define MPLS_BITFILED_H
14 #if (__BYTE_ORDER == __LITTLE_ENDIAN)
15 #define LITTLE_ENDIAN_BYTE_ORDER 1
18 /* macros to handle different byte orders (little endian or big endian) */
19 #ifdef LITTLE_ENDIAN_BYTE_ORDER
20 #define BITFIELDS_ASCENDING_2(X, Y) Y; X;
21 #define BITFIELDS_ASCENDING_3(X, Y, Z) Z; Y; X;
22 #define BITFIELDS_ASCENDING_4(X, Y, Z, W) W; Z; Y; X;
23 #define BITFIELDS_ASCENDING_7(X, Y, Z, W, U, A, B) B; A; U; W; Z; Y; X;
25 #define BITFIELDS_ASCENDING_2(X, Y) X; Y;
26 #define BITFIELDS_ASCENDING_3(X, Y, Z) X; Y; Z;
27 #define BITFIELDS_ASCENDING_4(X, Y, Z, W) X; Y; Z; W;
28 #define BITFIELDS_ASCENDING_7(X, Y, Z, W, U, A, B) X; Y; Z; W; U; A; B;
29 #endif /* LITTLE_ENDIAN_BYTE_ORDER */