|
|
|
@ -27,31 +27,29 @@ |
|
|
|
|
#ifndef HB_PRIVATE_H |
|
|
|
|
#define HB_PRIVATE_H |
|
|
|
|
|
|
|
|
|
#include "hb-common.h" |
|
|
|
|
|
|
|
|
|
#include <glib.h> |
|
|
|
|
|
|
|
|
|
/* 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 <stdlib.h> |
|
|
|
|
#include <stdio.h> /* XXX */ |
|
|
|
|
#include <string.h> |
|
|
|
|
#include <assert.h> |
|
|
|
|
|
|
|
|
|
#include "hb-common.h" |
|
|
|
|
|
|
|
|
|
#include <glib.h> |
|
|
|
|
|
|
|
|
|
/* 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 */ |
|
|
|
|