#ifndef __UTILITY_H #define __UTILITY_H #include #ifndef TRUE #define TRUE 1 #endif #ifndef FALSE #define FALSE 0 #endif #define NEW TRUE #define OLD FALSE #define APPEND FALSE typedef unsigned long ulong; typedef unsigned short ushort; typedef unsigned char uchar; #define xmin(x, y) ((x < y) ? x : y) #define xmax(x, y) ((x > y) ? x : y) ulong swapByte(ulong d, int n); long swapByte(long d, int n); ulong swapByte(ulong d); long swapByte(long d); ushort swapByte(ushort d); int swapByte(int d); uchar swapBits(uchar d); char swapBits(char d); void swapBits(uchar *d, int len); void swapBits(char *d, int len); int bitCount(ulong data); int bitCount(long data); int bitCount(ushort data); int bitCount(int data); int bitCount(uchar data); int bitCount(char data); void crcTableInit(); ulong crc32(uchar *d, int len); void promptWait(); void waitSecond(float sec); class DumpData { public: DumpData(int newFile); ~DumpData(); int dump(uchar *data, ushort nbytes); int currentFile(); private: int getFileNo(); private: FILE *fp; int fileNo; int newFile; int openError; }; #endif // __UTILITY_H