/* ======================================================================= * PROGRAMMER "BAHN, William" * TITLE "Integer Storage Size Type Definitions" * CREATED 06 FEB 07 * MODIFIED 06 FEB 07 * FILENAME "bytes.h" * ======================================================================= * GENERAL DESCRIPTION * * This file contains type definitions so that porting from one processor * to another is simpler. * ======================================================================= * SIZE DEFINITIONS * * The following definitions are used: * * SIZE UNSIGNED SIGNED * 8-bit BYTE SBYTE * 16-bit WORD SWORD * 32-bit DWORD SDWORD * 64-bit QWORD SQWORD (not available on most systems) * * ======================================================================= * To Verify Sizes * * Use the VerifySIZES() function passing the largest integer size, in * bits, that is of interest. * * The function returns TRUE if conflicts are found. * * If an argument of 0 is used, then the return value has a bit set for * each type definition that didn't verify, starting with the shortest * length in the LSB. * * Example - you are interested only in integer sizes up to 32-bits. * * VerifySIZES(32) or VerifySIZES(BITSinDWORD); * * ======================================================================= */ #ifndef BYTESdotH #define BYTESdotH #define BITSinBYTE ( 8) #define BITSinWORD (16) #define BITSinDWORD (32) #define BITSinQWORD (64) /* ======================================================================= * Normal definitions * * This the only section that should need to be changed. * * Determine which integer type is the correct number of bits and update * the following list. Do not worry about signed/unsigned. * * It is not recommended that you actually use these definitions in your * code - they are simply used in the following type definitions. * ======================================================================= */ #define NBYTE char #define NWORD short #define NDWORD int #define NQWORD long /* ======================================================================= * UNSIGNED TYPE DEFINITIONS * ======================================================================= */ typedef unsigned NBYTE BYTE; typedef unsigned NWORD WORD; typedef unsigned NDWORD DWORD; typedef unsigned NQWORD QWORD; /* ======================================================================= * SIGNED TYPE DEFINITIONS * ======================================================================= */ typedef signed NBYTE SBYTE; typedef signed NWORD SWORD; typedef signed NDWORD SDWORD; typedef signed NQWORD SQWORD; /* ======================================================================= * UTILITY FUNCTIONS * ======================================================================= */ unsigned int VerifySIZES(unsigned int maxlength); #endif