From: Behdad Esfahbod Date: Sun, 2 Aug 2009 00:46:02 +0000 (-0400) Subject: [HB] Assorted compiler macros X-Git-Tag: submit/2.0alpha-wayland/20121130.004132~9^2~1117 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=df66028781a7609a515980e64396e6f1044d764a;p=profile%2Fivi%2Forg.tizen.video-player.git [HB] Assorted compiler macros --- diff --git a/src/hb-ot-layout-open-private.h b/src/hb-ot-layout-open-private.h index 76a5ade..f46e023 100644 --- a/src/hb-ot-layout-open-private.h +++ b/src/hb-ot-layout-open-private.h @@ -215,8 +215,8 @@ struct Null \ private: char v[BYTES]; \ }; \ ASSERT_SIZE (NAME, BYTES) -#define DEFINE_INT_TYPE0(NAME, type, b) DEFINE_INT_TYPE1 (NAME, type, hb_be_##type, b) -#define DEFINE_INT_TYPE(NAME, u, w) DEFINE_INT_TYPE0 (NAME, u##int##w##_t, (w / 8)) +#define DEFINE_INT_TYPE0(NAME, type, b) DEFINE_INT_TYPE1 (NAME, type##_t, hb_be_##type, b) +#define DEFINE_INT_TYPE(NAME, u, w) DEFINE_INT_TYPE0 (NAME, u##int##w, (w / 8)) DEFINE_INT_TYPE (USHORT, u, 16); /* 16-bit unsigned integer. */ diff --git a/src/hb-private.h b/src/hb-private.h index 001aa09..2190b78 100644 --- a/src/hb-private.h +++ b/src/hb-private.h @@ -27,31 +27,29 @@ #ifndef HB_PRIVATE_H #define HB_PRIVATE_H -#include "hb-common.h" - -#include - -/* Macros to convert to/from BigEndian */ -#define hb_be_uint8_t -#define hb_be_int8_t -#define hb_be_uint16_t GUINT16_TO_BE -#define hb_be_int16_t GINT16_TO_BE -#define hb_be_uint32_t GUINT32_TO_BE -#define hb_be_int32_t GINT32_TO_BE -#define hb_be_uint64_t GUINT64_TO_BE -#define hb_be_int64_t GINT64_TO_BE - -#define HB_LIKELY G_LIKELY -#define HB_UNLIKELY G_UNLIKELY -#define HB_UNUSED(arg) ((arg) = (arg)) -#define HB_GNUC_UNUSED G_GNUC_UNUSED - +#if HAVE_CONFIG_H +#include "config.h" +#endif #include #include /* XXX */ #include #include +#include "hb-common.h" + +#include + +/* Macros to convert to/from BigEndian */ +#define hb_be_uint8 +#define hb_be_int8 +#define hb_be_uint16 GUINT16_TO_BE +#define hb_be_int16 GINT16_TO_BE +#define hb_be_uint32 GUINT32_TO_BE +#define hb_be_int32 GINT32_TO_BE +#define hb_be_uint64 GUINT64_TO_BE +#define hb_be_int64 GINT64_TO_BE + /* Basics */ #undef MIN @@ -83,6 +81,54 @@ #define ASSERT_SIZE(_type, _size) ASSERT_STATIC (sizeof (_type) == (_size)) +#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__) +#define _CAIRO_BOOLEAN_EXPR(expr) \ + __extension__ ({ \ + int _cairo_boolean_var_; \ + if (expr) \ + _cairo_boolean_var_ = 1; \ + else \ + _cairo_boolean_var_ = 0; \ + _cairo_boolean_var_; \ +}) +#define HB_LIKELY(expr) (__builtin_expect (_CAIRO_BOOLEAN_EXPR(expr), 1)) +#define HB_UNLIKELY(expr) (__builtin_expect (_CAIRO_BOOLEAN_EXPR(expr), 0)) +#else +#define HB_LIKELY(expr) (expr) +#define HB_UNLIKELY(expr) (expr) +#endif + +#ifndef __GNUC__ +#undef __attribute__ +#define __attribute__(x) +#endif + +#if __GNUC__ >= 3 +#define HB_GNUC_UNUSED __attribute__((unused)) +#define HB_GNUC_PURE __attribute__((pure)) +#define HB_GNUC_CONST __attribute__((const)) +#else +#define HB_GNUC_UNUSED +#define HB_GNUC_PURE +#define HB_GNUC_CONST +#endif + + +#if (defined(__WIN32__) && !defined(__WINE__)) || defined(_MSC_VER) +#define snprintf _snprintf +#endif + +#ifdef _MSC_VER +#undef inline +#define inline __inline +#endif + +#ifdef __STRICT_ANSI__ +#undef inline +#define inline __inline__ +#endif + + /* Return the number of 1 bits in mask. * * GCC 3.4 supports a "population count" builtin, which on many targets is @@ -90,7 +136,7 @@ * in libgcc in case a target does not have one, which should be just as * good as the open-coded solution below, (which is "HACKMEM 169"). */ -static inline unsigned int +static HB_GNUC_UNUSED inline unsigned int _hb_popcount32 (uint32_t mask) { #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) @@ -104,6 +150,8 @@ _hb_popcount32 (uint32_t mask) #endif } + + #include "hb-object-private.h" #endif /* HB_PRIVATE_H */