sdccutils.h

Go to the documentation of this file.
00001 00007 #ifndef SDCCUTILS_H 00008 #define SDCCUTILS_H // Only include this header file once 00009 00014 #define BIN(x) \ 00015 ( ((0x##x##L & 0x00000001L) ? 0x01 : 0) \ 00016 | ((0x##x##L & 0x00000010L) ? 0x02 : 0) \ 00017 | ((0x##x##L & 0x00000100L) ? 0x04 : 0) \ 00018 | ((0x##x##L & 0x00001000L) ? 0x08 : 0) \ 00019 | ((0x##x##L & 0x00010000L) ? 0x10 : 0) \ 00020 | ((0x##x##L & 0x00100000L) ? 0x20 : 0) \ 00021 | ((0x##x##L & 0x01000000L) ? 0x40 : 0) \ 00022 | ((0x##x##L & 0x10000000L) ? 0x80 : 0)) 00023 00024 00026 #define bit_test(x, y) ( x & (1<<y) ) 00027 00029 #define bit_clear(x, y) ( x&= ~(1<<y) ) 00030 00032 #define bit_set(x, y) ( x|= (1<<y) ) 00033 00035 #define bit_zeros(x) \ 00036 ( ((x & 1) ? 0 : 1) + \ 00037 ((x & 2) ? 0 : 1) + \ 00038 ((x & 4) ? 0 : 1) + \ 00039 ((x & 8) ? 0 : 1) + \ 00040 ((x & 16) ? 0 : 1) + \ 00041 ((x & 32) ? 0 : 1) + \ 00042 ((x & 64) ? 0 : 1) + \ 00043 ((x &128) ? 0 : 1) ) 00044 00046 #define bit_ones(x) \ 00047 ( ((x & 1) ? 1 : 0) + \ 00048 ((x & 2) ? 1 : 0) + \ 00049 ((x & 4) ? 1 : 0) + \ 00050 ((x & 8) ? 1 : 0) + \ 00051 ((x & 16) ? 1 : 0) + \ 00052 ((x & 32) ? 1 : 0) + \ 00053 ((x & 64) ? 1 : 0) + \ 00054 ((x &128) ? 1 : 0) ) 00055 00056 // define some boolean types and synonyms 00057 00058 #ifndef TRUE 00059 #define TRUE 1 00060 #define FALSE 0 00061 #endif 00062 00063 #ifndef true 00064 #define true TRUE 00065 #define false FALSE 00066 #endif 00067 00069 #define boolean bool 00070 00071 #endif

Generated on Fri Aug 27 10:04:03 2004 for Cheap Sensor Network by doxygen 1.3.8