[cairoint] Move endian-conversion routines into cairoint.h

This commit is contained in:
Behdad Esfahbod 2007-03-07 15:53:27 -05:00
parent 62e864e73c
commit 2cc1c73705
3 changed files with 35 additions and 65 deletions

View file

@ -125,34 +125,6 @@ typedef struct _cairo_cff_font {
} cairo_cff_font_t;
#ifdef WORDS_BIGENDIAN
#define cpu_to_be16(v) (v)
#define be16_to_cpu(v) (v)
#define cpu_to_be32(v) (v)
#else
static inline uint16_t
cpu_to_be16(uint16_t v)
{
return (v << 8) | (v >> 8);
}
static inline uint16_t
be16_to_cpu(uint16_t v)
{
return cpu_to_be16 (v);
}
static inline uint32_t
cpu_to_be32(uint32_t v)
{
return (cpu_to_be16 (v) << 16) | cpu_to_be16 (v >> 16);
}
#endif
/* Encoded integer using maximum sized encoding. This is required for
* operands that are later modified after encoding. */
static unsigned char *

View file

@ -80,43 +80,6 @@ cairo_truetype_font_use_glyph (cairo_truetype_font_t *font, int glyph);
#define SFNT_VERSION 0x00010000
#define SFNT_STRING_MAX_LENGTH 65535
#ifdef WORDS_BIGENDIAN
#define cpu_to_be16(v) (v)
#define be16_to_cpu(v) (v)
#define cpu_to_be32(v) (v)
#define be32_to_cpu(v) (v)
#else
static inline uint16_t
cpu_to_be16(uint16_t v)
{
return (v << 8) | (v >> 8);
}
static inline uint16_t
be16_to_cpu(uint16_t v)
{
return cpu_to_be16 (v);
}
static inline uint32_t
cpu_to_be32(uint32_t v)
{
return (cpu_to_be16 (v) << 16) | cpu_to_be16 (v >> 16);
}
static inline uint32_t
be32_to_cpu(uint32_t v)
{
return cpu_to_be32 (v);
}
#endif
static cairo_status_t
_cairo_truetype_font_create (cairo_scaled_font_subset_t *scaled_font_subset,
cairo_truetype_font_t **font_return)

View file

@ -272,6 +272,41 @@ typedef cairo_fixed_16_16_t cairo_fixed_t;
#define CAIRO_BITSWAP8_IF_LITTLE_ENDIAN(c) CAIRO_BITSWAP8(c)
#endif
#ifdef WORDS_BIGENDIAN
#define cpu_to_be16(v) (v)
#define be16_to_cpu(v) (v)
#define cpu_to_be32(v) (v)
#define be32_to_cpu(v) (v)
#else
static inline uint16_t
cpu_to_be16(uint16_t v)
{
return (v << 8) | (v >> 8);
}
static inline uint16_t
be16_to_cpu(uint16_t v)
{
return cpu_to_be16 (v);
}
static inline uint32_t
cpu_to_be32(uint32_t v)
{
return (cpu_to_be16 (v) << 16) | cpu_to_be16 (v >> 16);
}
static inline uint32_t
be32_to_cpu(uint32_t v)
{
return cpu_to_be32 (v);
}
#endif
#include "cairo-hash-private.h"
#include "cairo-cache-private.h"