qbdefs.h   qbdefs.h 
skipping to change at line 23 skipping to change at line 23
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details. * GNU Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with libqb. If not, see <http://www.gnu.org/licenses/>. * along with libqb. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef QB_DEFS_H_DEFINED #ifndef QB_DEFS_H_DEFINED
#define QB_DEFS_H_DEFINED #define QB_DEFS_H_DEFINED
/* *INDENT-OFF* */
#ifdef __cplusplus
extern "C" {
#endif
/* *INDENT-ON* */
/** /**
* @file qbdefs.h * @file qbdefs.h
* @author Angus Salkeld <asalkeld@redhat.com> * @author Angus Salkeld <asalkeld@redhat.com>
* *
* These are some convience macros and defines. * These are some convience macros and defines.
*/ */
/* *INDENT-OFF* */
#ifdef __cplusplus
extern "C" {
#endif
/* *INDENT-ON* */
/* /*
* simple math macros * simple math macros
*/ */
#define QB_ROUNDUP(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) #define QB_ROUNDUP(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
#define QB_ABS(i) (((i) < 0) ? -(i) : (i)) #define QB_ABS(i) (((i) < 0) ? -(i) : (i))
#define QB_MAX(a, b) (((a) > (b)) ? (a) : (b)) #define QB_MAX(a, b) (((a) > (b)) ? (a) : (b))
#define QB_MIN(a, b) (((a) < (b)) ? (a) : (b)) #define QB_MIN(a, b) (((a) < (b)) ? (a) : (b))
/* /*
* the usual boolean defines * the usual boolean defines
*/ */
#define QB_FALSE 0 #define QB_FALSE 0
#define QB_TRUE (!QB_FALSE) #define QB_TRUE (!QB_FALSE)
/* /*
* bit manipulation
*/
#define qb_bit_value(bit) (1 << (bit))
#define qb_bit_set(barray, bit) (barray |= qb_bit_value(bit))
#define qb_bit_clear(barray, bit) (barray &= ~(qb_bit_value(bit)))
#define qb_bit_is_set(barray, bit) (barray & qb_bit_value(bit))
#define qb_bit_is_clear(barray, bit) (!(barray & qb_bit_value(bit)))
/*
* handy time based converters. * handy time based converters.
*/ */
#ifndef HZ #ifndef HZ
#define HZ 100 /* 10ms */ #define HZ 100 /* 10ms */
#endif #endif
#define QB_TIME_MS_IN_SEC 1000ULL #define QB_TIME_MS_IN_SEC 1000ULL
#define QB_TIME_US_IN_SEC 1000000ULL #define QB_TIME_US_IN_SEC 1000000ULL
#define QB_TIME_NS_IN_SEC 1000000000ULL #define QB_TIME_NS_IN_SEC 1000000000ULL
#define QB_TIME_US_IN_MSEC 1000ULL #define QB_TIME_US_IN_MSEC 1000ULL
#define QB_TIME_NS_IN_MSEC 1000000ULL #define QB_TIME_NS_IN_MSEC 1000000ULL
#define QB_TIME_NS_IN_USEC 1000ULL #define QB_TIME_NS_IN_USEC 1000ULL
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) #if defined (__GNUC__) && defined (__STRICT_ANSI__)
#undef inline
#define inline __inline__
#undef typeof
#define typeof __typeof__
#endif /* ANSI */
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
#define QB_GNUC_DEPRECATED \ #define QB_GNUC_DEPRECATED \
__attribute__((__deprecated__)) __attribute__((__deprecated__))
#else #else
#define QB_GNUC_DEPRECATED #define QB_GNUC_DEPRECATED
#endif /* __GNUC__ */ #endif /* __GNUC__ */
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
#define QB_GNUC_DEPRECATED_FOR(f) \ #define QB_GNUC_DEPRECATED_FOR(f) \
__attribute__((deprecated("Use " #f " instead"))) __attribute__((deprecated("Use " #f " instead")))
#else #else
#define QB_GNUC_DEPRECATED_FOR(f) QB_GNUC_DEPRECATED #define QB_GNUC_DEPRECATED_FOR(f) QB_GNUC_DEPRECATED
#endif /* __GNUC__ */ #endif /* __GNUC__ */
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
# define QB_GNUC_MAY_ALIAS __attribute__((may_alias)) #define QB_GNUC_MAY_ALIAS __attribute__((may_alias))
#else #else
# define QB_GNUC_MAY_ALIAS #define QB_GNUC_MAY_ALIAS
#endif #endif
/* *INDENT-OFF* */ /* *INDENT-OFF* */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */
/* *INDENT-ON* */ /* *INDENT-ON* */
#endif /* QB_DEFS_H_DEFINED */ #endif /* QB_DEFS_H_DEFINED */
 End of changes. 6 change blocks. 
9 lines changed or deleted 25 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/