unify inlining method in prep for inline tests

This commit is contained in:
Josh Coalson
2007-03-12 05:08:21 +00:00
parent 10a6840138
commit 14b184cced
5 changed files with 28 additions and 20 deletions

View File

@@ -39,6 +39,10 @@
#include "FLAC/format.h" #include "FLAC/format.h"
#include "private/format.h" #include "private/format.h"
#ifndef FLaC__INLINE
#define FLaC__INLINE
#endif
#ifdef min #ifdef min
#undef min #undef min
#endif #endif
@@ -294,7 +298,7 @@ FLAC_API unsigned FLAC__format_seektable_sort(FLAC__StreamMetadata_SeekTable *se
* and a more clear explanation at the end of this section: * and a more clear explanation at the end of this section:
* http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 * http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
*/ */
static __inline unsigned utf8len_(const FLAC__byte *utf8) static FLaC__INLINE unsigned utf8len_(const FLAC__byte *utf8)
{ {
FLAC__ASSERT(0 != utf8); FLAC__ASSERT(0 != utf8);
if ((utf8[0] & 0x80) == 0) { if ((utf8[0] & 0x80) == 0) {

View File

@@ -71,6 +71,10 @@
#include "private/stream_encoder_framing.h" #include "private/stream_encoder_framing.h"
#include "private/window.h" #include "private/window.h"
#ifndef FLaC__INLINE
#define FLaC__INLINE
#endif
#ifdef min #ifdef min
#undef min #undef min
#endif #endif
@@ -4068,7 +4072,7 @@ void precompute_partition_info_escapes_(
} }
#ifdef EXACT_RICE_BITS_CALCULATION #ifdef EXACT_RICE_BITS_CALCULATION
static __inline unsigned count_rice_bits_in_partition_( static FLaC__INLINE unsigned count_rice_bits_in_partition_(
const unsigned rice_parameter, const unsigned rice_parameter,
const unsigned partition_samples, const unsigned partition_samples,
const FLAC__int32 *residual const FLAC__int32 *residual
@@ -4083,7 +4087,7 @@ static __inline unsigned count_rice_bits_in_partition_(
return partition_bits; return partition_bits;
} }
#else #else
static __inline unsigned count_rice_bits_in_partition_( static FLaC__INLINE unsigned count_rice_bits_in_partition_(
const unsigned rice_parameter, const unsigned rice_parameter,
const unsigned partition_samples, const unsigned partition_samples,
const FLAC__uint64 abs_residual_partition_sum const FLAC__uint64 abs_residual_partition_sum

View File

@@ -32,19 +32,17 @@
#endif #endif
#define max(a,b) ((a)>(b)?(a):(b)) #define max(a,b) ((a)>(b)?(a):(b))
#ifndef FLaC__INLINE
#if defined _MSC_VER #define FLaC__INLINE
#define FLAC__INLINE __inline
#else
#define FLAC__INLINE
#endif #endif
/* 32-bit pseudo-random number generator /* 32-bit pseudo-random number generator
* *
* @@@ According to Miroslav, this one is poor quality, the one from the * @@@ According to Miroslav, this one is poor quality, the one from the
* @@@ original replaygain code is much better * @@@ original replaygain code is much better
*/ */
static FLAC__INLINE FLAC__uint32 prng(FLAC__uint32 state) static FLaC__INLINE FLAC__uint32 prng(FLAC__uint32 state)
{ {
return (state * 0x0019660dL + 0x3c6ef35fL) & 0xffffffffL; return (state * 0x0019660dL + 0x3c6ef35fL) & 0xffffffffL;
} }
@@ -56,7 +54,7 @@ typedef struct {
FLAC__int32 random; FLAC__int32 random;
} dither_state; } dither_state;
static FLAC__INLINE FLAC__int32 linear_dither(unsigned source_bps, unsigned target_bps, FLAC__int32 sample, dither_state *dither, const FLAC__int32 MIN, const FLAC__int32 MAX) static FLaC__INLINE FLAC__int32 linear_dither(unsigned source_bps, unsigned target_bps, FLAC__int32 sample, dither_state *dither, const FLAC__int32 MIN, const FLAC__int32 MAX)
{ {
unsigned scalebits; unsigned scalebits;
FLAC__int32 output, mask, random; FLAC__int32 output, mask, random;

View File

@@ -28,8 +28,12 @@
#include "FLAC/assert.h" #include "FLAC/assert.h"
#include "FLAC/metadata.h" #include "FLAC/metadata.h"
#ifndef FLaC__INLINE
#define FLaC__INLINE
#endif
static __inline unsigned local__wide_strlen(const FLAC__uint16 *s)
static FLaC__INLINE unsigned local__wide_strlen(const FLAC__uint16 *s)
{ {
unsigned n = 0; unsigned n = 0;
while(*s++) while(*s++)
@@ -43,7 +47,7 @@ static __inline unsigned local__wide_strlen(const FLAC__uint16 *s)
* and a more clear explanation at the end of this section: * and a more clear explanation at the end of this section:
* http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 * http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
*/ */
static __inline unsigned local__utf8len(const FLAC__byte *utf8) static FLaC__INLINE unsigned local__utf8len(const FLAC__byte *utf8)
{ {
FLAC__ASSERT(0 != utf8); FLAC__ASSERT(0 != utf8);
if ((utf8[0] & 0x80) == 0) { if ((utf8[0] & 0x80) == 0) {
@@ -85,7 +89,7 @@ static __inline unsigned local__utf8len(const FLAC__byte *utf8)
} }
static __inline unsigned local__utf8_to_ucs2(const FLAC__byte *utf8, FLAC__uint16 *ucs2) static FLaC__INLINE unsigned local__utf8_to_ucs2(const FLAC__byte *utf8, FLAC__uint16 *ucs2)
{ {
const unsigned len = local__utf8len(utf8); const unsigned len = local__utf8len(utf8);
@@ -140,7 +144,7 @@ static FLAC__uint16 *local__convert_utf8_to_ucs2(const char *src, unsigned lengt
return out; return out;
} }
static __inline unsigned local__ucs2len(FLAC__uint16 ucs2) static FLaC__INLINE unsigned local__ucs2len(FLAC__uint16 ucs2)
{ {
if (ucs2 < 0x0080) if (ucs2 < 0x0080)
return 1; return 1;
@@ -150,7 +154,7 @@ static __inline unsigned local__ucs2len(FLAC__uint16 ucs2)
return 3; return 3;
} }
static __inline unsigned local__ucs2_to_utf8(FLAC__uint16 ucs2, FLAC__byte *utf8) static FLaC__INLINE unsigned local__ucs2_to_utf8(FLAC__uint16 ucs2, FLAC__byte *utf8)
{ {
if (ucs2 < 0x080) { if (ucs2 < 0x080) {
utf8[0] = (FLAC__byte)ucs2; utf8[0] = (FLAC__byte)ucs2;

View File

@@ -44,10 +44,8 @@
#include "replaygain_synthesis.h" #include "replaygain_synthesis.h"
#include "FLAC/assert.h" #include "FLAC/assert.h"
#if defined _MSC_VER #ifndef FLaC__INLINE
#define FLAC__INLINE __inline #define FLaC__INLINE
#else
#define FLAC__INLINE
#endif #endif
/* adjust for compilers that can't understand using LL suffix for int64_t literals */ /* adjust for compilers that can't understand using LL suffix for int64_t literals */
@@ -238,7 +236,7 @@ void FLAC__replaygain_synthesis__init_dither_context(DitherContext *d, int bits,
* the following is based on parts of wavegain.c * the following is based on parts of wavegain.c
*/ */
static FLAC__INLINE FLAC__int64 dither_output_(DitherContext *d, FLAC__bool do_dithering, int shapingtype, int i, double Sum, int k) static FLaC__INLINE FLAC__int64 dither_output_(DitherContext *d, FLAC__bool do_dithering, int shapingtype, int i, double Sum, int k)
{ {
union { union {
double d; double d;