00001 /*! \file include/const.h 00002 * \brief Global constants definition. 00003 * \author Andrea Righi <drizzt@inwind.it> 00004 * \date Last update:\n 00005 * 2003-12-16 Andrea Righi: 00006 * Added pid_t typedef.\n 00007 * 2004-13-01 Andrea Righi: 00008 * New kernel style.\n 00009 * \note Copyright (©) 2003 Andrea Righi 00010 */ 00011 00012 #ifndef CONST_H 00013 #define CONST_H 00014 00015 #include <kernel/config.h> 00016 #include <types.h> 00017 00018 // --- Global constants ----------------------------------------------- // 00019 00020 //! Logical value of TRUE. 00021 #define TRUE 1 00022 //! Logical value of FALSE. 00023 #define FALSE 0 00024 //! NULL constant. 00025 #define NULL 0 00026 00027 //! Little endian architecture. 00028 #define __LITTLE_ENDIAN__ 1234 00029 //! Big endian architecture. 00030 #define __BIG_ENDIAN__ 4321 00031 //! The current architecture. 00032 #define __BYTE_ORDER__ __LITTLE_ENDIAN__ 00033 00034 // --- Useful macros -------------------------------------------------- // 00035 00036 //! This macro returns the minimum value between \a a and \a b. 00037 #define MIN(a, b) ((a) < (b) ? (a) : (b)) 00038 //! This macro returns the maximum value between \a a and \a b. 00039 #define MAX(a, b) ((a) > (b) ? (a) : (b)) 00040 //! This macro returns the absolute value of \a a. 00041 #define ABS(a) ((a) < 0 ? -(a) : (a)) 00042 //! This macro truncates \a addr to the \a align boundary. 00043 #define TRUNC(addr, align) ((addr) & ~((align) - 1)) 00044 //! This macro rounds down \a addr to the \a align boundary. 00045 #define ALIGN_DOWN(addr, align) TRUNC(addr, align) 00046 //! This macro rounds up \a addr to the \a align boundary. 00047 #define ALIGN_UP(addr, align) ( ((addr) + (align) - 1) & (~((align) - 1)) ) 00048 00049 #endif