prefix by order macros with PA_

git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1884 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
Lennart Poettering 2007-09-22 01:16:14 +00:00
parent 668340099c
commit c6b43bf119
8 changed files with 96 additions and 93 deletions

View file

@ -36,56 +36,59 @@
#endif #endif
#ifdef HAVE_BYTESWAP_H #ifdef HAVE_BYTESWAP_H
#define INT16_SWAP(x) ((int16_t) bswap_16((uint16_t) x)) #define PA_INT16_SWAP(x) ((int16_t) bswap_16((uint16_t) x))
#define UINT16_SWAP(x) ((uint16_t) bswap_16((uint16_t) x)) #define PA_UINT16_SWAP(x) ((uint16_t) bswap_16((uint16_t) x))
#define INT32_SWAP(x) ((int32_t) bswap_32((uint32_t) x)) #define PA_INT32_SWAP(x) ((int32_t) bswap_32((uint32_t) x))
#define UINT32_SWAP(x) ((uint32_t) bswap_32((uint32_t) x)) #define PA_UINT32_SWAP(x) ((uint32_t) bswap_32((uint32_t) x))
#else #else
#define INT16_SWAP(x) ( (int16_t) ( ((uint16_t) x >> 8) | ((uint16_t) x << 8) ) ) #define PA_INT16_SWAP(x) ( (int16_t) ( ((uint16_t) x >> 8) | ((uint16_t) x << 8) ) )
#define UINT16_SWAP(x) ( (uint16_t) ( ((uint16_t) x >> 8) | ((uint16_t) x << 8) ) ) #define PA_UINT16_SWAP(x) ( (uint16_t) ( ((uint16_t) x >> 8) | ((uint16_t) x << 8) ) )
#define INT32_SWAP(x) ( (int32_t) ( ((uint32_t) x >> 24) | ((uint32_t) x << 24) | (((uint32_t) x & 0xFF00) << 8) | ((((uint32_t) x) >> 8) & 0xFF00) ) ) #define PA_INT32_SWAP(x) ( (int32_t) ( ((uint32_t) x >> 24) | ((uint32_t) x << 24) | (((uint32_t) x & 0xFF00) << 8) | ((((uint32_t) x) >> 8) & 0xFF00) ) )
#define UINT32_SWAP(x) ( (uint32_t) ( ((uint32_t) x >> 24) | ((uint32_t) x << 24) | (((uint32_t) x & 0xFF00) << 8) | ((((uint32_t) x) >> 8) & 0xFF00) ) ) #define PA_UINT32_SWAP(x) ( (uint32_t) ( ((uint32_t) x >> 24) | ((uint32_t) x << 24) | (((uint32_t) x & 0xFF00) << 8) | ((((uint32_t) x) >> 8) & 0xFF00) ) )
#endif #endif
#define MAYBE_INT32_SWAP(c,x) ((c) ? INT32_SWAP(x) : x) #define PA_MAYBE_INT16_SWAP(c,x) ((c) ? PA_INT32_SWAP(x) : x)
#define MAYBE_UINT32_SWAP(c,x) ((c) ? UINT32_SWAP(x) : x) #define PA_MAYBE_UINT16_SWAP(c,x) ((c) ? PA_UINT32_SWAP(x) : x)
#define PA_MAYBE_INT32_SWAP(c,x) ((c) ? PA_INT32_SWAP(x) : x)
#define PA_MAYBE_UINT32_SWAP(c,x) ((c) ? PA_UINT32_SWAP(x) : x)
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
#define INT16_FROM_LE(x) INT16_SWAP(x) #define PA_INT16_FROM_LE(x) PA_INT16_SWAP(x)
#define INT16_FROM_BE(x) ((int16_t)(x)) #define PA_INT16_FROM_BE(x) ((int16_t)(x))
#define INT16_TO_LE(x) INT16_SWAP(x) #define PA_INT16_TO_LE(x) PA_INT16_SWAP(x)
#define INT16_TO_BE(x) ((int16_t)(x)) #define PA_INT16_TO_BE(x) ((int16_t)(x))
#define UINT16_FROM_LE(x) UINT16_SWAP(x) #define PA_UINT16_FROM_LE(x) PA_UINT16_SWAP(x)
#define UINT16_FROM_BE(x) ((uint16_t)(x)) #define PA_UINT16_FROM_BE(x) ((uint16_t)(x))
#define INT32_FROM_LE(x) INT32_SWAP(x) #define PA_INT32_FROM_LE(x) PA_INT32_SWAP(x)
#define INT32_FROM_BE(x) ((int32_t)(x)) #define PA_INT32_FROM_BE(x) ((int32_t)(x))
#define UINT32_FROM_LE(x) UINT32_SWAP(x) #define PA_UINT32_FROM_LE(x) PA_UINT32_SWAP(x)
#define UINT32_FROM_BE(x) ((uint32_t)(x)) #define PA_UINT32_FROM_BE(x) ((uint32_t)(x))
#define UINT32_TO_LE(x) UINT32_SWAP(x) #define PA_UINT32_TO_LE(x) PA_UINT32_SWAP(x)
#define UINT32_TO_BE(x) ((uint32_t)(x)) #define PA_UINT32_TO_BE(x) ((uint32_t)(x))
#else #else
#define INT16_FROM_LE(x) ((int16_t)(x)) #define PA_INT16_FROM_LE(x) ((int16_t)(x))
#define INT16_FROM_BE(x) INT16_SWAP(x) #define PA_INT16_FROM_BE(x) PA_INT16_SWAP(x)
#define INT16_TO_LE(x) ((int16_t)(x)) #define PA_INT16_TO_LE(x) ((int16_t)(x))
#define INT16_TO_BE(x) INT16_SWAP(x) #define PA_INT16_TO_BE(x) PA_INT16_SWAP(x)
#define UINT16_FROM_LE(x) ((uint16_t)(x)) #define PA_UINT16_FROM_LE(x) ((uint16_t)(x))
#define UINT16_FROM_BE(x) UINT16_SWAP(x) #define PA_UINT16_FROM_BE(x) PA_UINT16_SWAP(x)
#define INT32_FROM_LE(x) ((int32_t)(x)) #define PA_INT32_FROM_LE(x) ((int32_t)(x))
#define INT32_FROM_BE(x) INT32_SWAP(x) #define PA_INT32_FROM_BE(x) PA_INT32_SWAP(x)
#define UINT32_FROM_LE(x) ((uint32_t)(x)) #define PA_UINT32_FROM_LE(x) ((uint32_t)(x))
#define UINT32_FROM_BE(x) UINT32_SWAP(x) #define PA_UINT32_FROM_BE(x) PA_UINT32_SWAP(x)
#define UINT32_TO_LE(x) ((uint32_t)(x)) #define PA_UINT32_TO_LE(x) ((uint32_t)(x))
#define UINT32_TO_BE(x) UINT32_SWAP(x) #define PA_UINT32_TO_BE(x) PA_UINT32_SWAP(x)
#endif #endif
#endif #endif

View file

@ -205,7 +205,7 @@ typedef int esd_client_state_t;
/* the endian key is transferred in binary, if it's read into int, */ /* the endian key is transferred in binary, if it's read into int, */
/* and matches ESD_ENDIAN_KEY (ENDN), then the endianness of the */ /* and matches ESD_ENDIAN_KEY (ENDN), then the endianness of the */
/* server and the client match; if it's SWAP_ENDIAN_KEY, swap data */ /* server and the client match; if it's SWAP_ENDIAN_KEY, swap data */
#define ESD_SWAP_ENDIAN_KEY (UINT32_SWAP(ESD_ENDIAN_KEY)) #define ESD_SWAP_ENDIAN_KEY (PA_UINT32_SWAP(ESD_ENDIAN_KEY))
#endif #endif

View file

@ -381,11 +381,11 @@ static int esd_proto_stream_play(connection *c, PA_GCC_UNUSED esd_proto_t reques
pa_assert(length == (sizeof(int32_t)*2+ESD_NAME_MAX)); pa_assert(length == (sizeof(int32_t)*2+ESD_NAME_MAX));
memcpy(&format, data, sizeof(int32_t)); memcpy(&format, data, sizeof(int32_t));
format = MAYBE_INT32_SWAP(c->swap_byte_order, format); format = PA_MAYBE_INT32_SWAP(c->swap_byte_order, format);
data = (const char*) data + sizeof(int32_t); data = (const char*) data + sizeof(int32_t);
memcpy(&rate, data, sizeof(int32_t)); memcpy(&rate, data, sizeof(int32_t));
rate = MAYBE_INT32_SWAP(c->swap_byte_order, rate); rate = PA_MAYBE_INT32_SWAP(c->swap_byte_order, rate);
data = (const char*) data + sizeof(int32_t); data = (const char*) data + sizeof(int32_t);
ss.rate = rate; ss.rate = rate;
@ -462,11 +462,11 @@ static int esd_proto_stream_record(connection *c, esd_proto_t request, const voi
pa_assert(length == (sizeof(int32_t)*2+ESD_NAME_MAX)); pa_assert(length == (sizeof(int32_t)*2+ESD_NAME_MAX));
memcpy(&format, data, sizeof(int32_t)); memcpy(&format, data, sizeof(int32_t));
format = MAYBE_INT32_SWAP(c->swap_byte_order, format); format = PA_MAYBE_INT32_SWAP(c->swap_byte_order, format);
data = (const char*) data + sizeof(int32_t); data = (const char*) data + sizeof(int32_t);
memcpy(&rate, data, sizeof(int32_t)); memcpy(&rate, data, sizeof(int32_t));
rate = MAYBE_INT32_SWAP(c->swap_byte_order, rate); rate = PA_MAYBE_INT32_SWAP(c->swap_byte_order, rate);
data = (const char*) data + sizeof(int32_t); data = (const char*) data + sizeof(int32_t);
ss.rate = rate; ss.rate = rate;
@ -559,7 +559,7 @@ static int esd_proto_get_latency(connection *c, PA_GCC_UNUSED esd_proto_t reques
latency = (int) ((usec*44100)/1000000); latency = (int) ((usec*44100)/1000000);
} }
latency = MAYBE_INT32_SWAP(c->swap_byte_order, latency); latency = PA_MAYBE_INT32_SWAP(c->swap_byte_order, latency);
connection_write(c, &latency, sizeof(int32_t)); connection_write(c, &latency, sizeof(int32_t));
return 0; return 0;
} }
@ -582,9 +582,9 @@ static int esd_proto_server_info(connection *c, PA_GCC_UNUSED esd_proto_t reques
response = 0; response = 0;
connection_write(c, &response, sizeof(int32_t)); connection_write(c, &response, sizeof(int32_t));
rate = MAYBE_INT32_SWAP(c->swap_byte_order, rate); rate = PA_MAYBE_INT32_SWAP(c->swap_byte_order, rate);
connection_write(c, &rate, sizeof(int32_t)); connection_write(c, &rate, sizeof(int32_t));
format = MAYBE_INT32_SWAP(c->swap_byte_order, format); format = PA_MAYBE_INT32_SWAP(c->swap_byte_order, format);
connection_write(c, &format, sizeof(int32_t)); connection_write(c, &format, sizeof(int32_t));
return 0; return 0;
@ -631,7 +631,7 @@ static int esd_proto_all_info(connection *c, esd_proto_t request, const void *da
} }
/* id */ /* id */
id = MAYBE_INT32_SWAP(c->swap_byte_order, (int32_t) (conn->index+1)); id = PA_MAYBE_INT32_SWAP(c->swap_byte_order, (int32_t) (conn->index+1));
connection_write(c, &id, sizeof(int32_t)); connection_write(c, &id, sizeof(int32_t));
/* name */ /* name */
@ -643,19 +643,19 @@ static int esd_proto_all_info(connection *c, esd_proto_t request, const void *da
connection_write(c, name, ESD_NAME_MAX); connection_write(c, name, ESD_NAME_MAX);
/* rate */ /* rate */
rate = MAYBE_INT32_SWAP(c->swap_byte_order, rate); rate = PA_MAYBE_INT32_SWAP(c->swap_byte_order, rate);
connection_write(c, &rate, sizeof(int32_t)); connection_write(c, &rate, sizeof(int32_t));
/* left */ /* left */
lvolume = MAYBE_INT32_SWAP(c->swap_byte_order, lvolume); lvolume = PA_MAYBE_INT32_SWAP(c->swap_byte_order, lvolume);
connection_write(c, &lvolume, sizeof(int32_t)); connection_write(c, &lvolume, sizeof(int32_t));
/*right*/ /*right*/
rvolume = MAYBE_INT32_SWAP(c->swap_byte_order, rvolume); rvolume = PA_MAYBE_INT32_SWAP(c->swap_byte_order, rvolume);
connection_write(c, &rvolume, sizeof(int32_t)); connection_write(c, &rvolume, sizeof(int32_t));
/*format*/ /*format*/
format = MAYBE_INT32_SWAP(c->swap_byte_order, format); format = PA_MAYBE_INT32_SWAP(c->swap_byte_order, format);
connection_write(c, &format, sizeof(int32_t)); connection_write(c, &format, sizeof(int32_t));
t -= k; t -= k;
@ -677,7 +677,7 @@ static int esd_proto_all_info(connection *c, esd_proto_t request, const void *da
pa_assert(t >= s*2); pa_assert(t >= s*2);
/* id */ /* id */
id = MAYBE_INT32_SWAP(c->swap_byte_order, (int) (ce->index+1)); id = PA_MAYBE_INT32_SWAP(c->swap_byte_order, (int) (ce->index+1));
connection_write(c, &id, sizeof(int32_t)); connection_write(c, &id, sizeof(int32_t));
/* name */ /* name */
@ -689,23 +689,23 @@ static int esd_proto_all_info(connection *c, esd_proto_t request, const void *da
connection_write(c, name, ESD_NAME_MAX); connection_write(c, name, ESD_NAME_MAX);
/* rate */ /* rate */
rate = MAYBE_UINT32_SWAP(c->swap_byte_order, ce->sample_spec.rate); rate = PA_MAYBE_UINT32_SWAP(c->swap_byte_order, ce->sample_spec.rate);
connection_write(c, &rate, sizeof(int32_t)); connection_write(c, &rate, sizeof(int32_t));
/* left */ /* left */
lvolume = MAYBE_UINT32_SWAP(c->swap_byte_order, (ce->volume.values[0]*ESD_VOLUME_BASE)/PA_VOLUME_NORM); lvolume = PA_MAYBE_UINT32_SWAP(c->swap_byte_order, (ce->volume.values[0]*ESD_VOLUME_BASE)/PA_VOLUME_NORM);
connection_write(c, &lvolume, sizeof(int32_t)); connection_write(c, &lvolume, sizeof(int32_t));
/*right*/ /*right*/
rvolume = MAYBE_UINT32_SWAP(c->swap_byte_order, (ce->volume.values[0]*ESD_VOLUME_BASE)/PA_VOLUME_NORM); rvolume = PA_MAYBE_UINT32_SWAP(c->swap_byte_order, (ce->volume.values[0]*ESD_VOLUME_BASE)/PA_VOLUME_NORM);
connection_write(c, &rvolume, sizeof(int32_t)); connection_write(c, &rvolume, sizeof(int32_t));
/*format*/ /*format*/
format = MAYBE_INT32_SWAP(c->swap_byte_order, format_native2esd(&ce->sample_spec)); format = PA_MAYBE_INT32_SWAP(c->swap_byte_order, format_native2esd(&ce->sample_spec));
connection_write(c, &format, sizeof(int32_t)); connection_write(c, &format, sizeof(int32_t));
/*length*/ /*length*/
len = MAYBE_INT32_SWAP(c->swap_byte_order, (int) ce->memchunk.length); len = PA_MAYBE_INT32_SWAP(c->swap_byte_order, (int) ce->memchunk.length);
connection_write(c, &len, sizeof(int32_t)); connection_write(c, &len, sizeof(int32_t));
t -= s; t -= s;
@ -729,15 +729,15 @@ static int esd_proto_stream_pan(connection *c, PA_GCC_UNUSED esd_proto_t request
pa_assert(length == sizeof(int32_t)*3); pa_assert(length == sizeof(int32_t)*3);
memcpy(&idx, data, sizeof(uint32_t)); memcpy(&idx, data, sizeof(uint32_t));
idx = MAYBE_UINT32_SWAP(c->swap_byte_order, idx) - 1; idx = PA_MAYBE_UINT32_SWAP(c->swap_byte_order, idx) - 1;
data = (const char*)data + sizeof(uint32_t); data = (const char*)data + sizeof(uint32_t);
memcpy(&lvolume, data, sizeof(uint32_t)); memcpy(&lvolume, data, sizeof(uint32_t));
lvolume = MAYBE_UINT32_SWAP(c->swap_byte_order, lvolume); lvolume = PA_MAYBE_UINT32_SWAP(c->swap_byte_order, lvolume);
data = (const char*)data + sizeof(uint32_t); data = (const char*)data + sizeof(uint32_t);
memcpy(&rvolume, data, sizeof(uint32_t)); memcpy(&rvolume, data, sizeof(uint32_t));
rvolume = MAYBE_UINT32_SWAP(c->swap_byte_order, rvolume); rvolume = PA_MAYBE_UINT32_SWAP(c->swap_byte_order, rvolume);
data = (const char*)data + sizeof(uint32_t); data = (const char*)data + sizeof(uint32_t);
if ((conn = pa_idxset_get_by_index(c->protocol->connections, idx)) && conn->sink_input) { if ((conn = pa_idxset_get_by_index(c->protocol->connections, idx)) && conn->sink_input) {
@ -766,11 +766,11 @@ static int esd_proto_sample_cache(connection *c, PA_GCC_UNUSED esd_proto_t reque
pa_assert(length == (ESD_NAME_MAX+3*sizeof(int32_t))); pa_assert(length == (ESD_NAME_MAX+3*sizeof(int32_t)));
memcpy(&format, data, sizeof(int32_t)); memcpy(&format, data, sizeof(int32_t));
format = MAYBE_INT32_SWAP(c->swap_byte_order, format); format = PA_MAYBE_INT32_SWAP(c->swap_byte_order, format);
data = (const char*)data + sizeof(int32_t); data = (const char*)data + sizeof(int32_t);
memcpy(&rate, data, sizeof(int32_t)); memcpy(&rate, data, sizeof(int32_t));
rate = MAYBE_INT32_SWAP(c->swap_byte_order, rate); rate = PA_MAYBE_INT32_SWAP(c->swap_byte_order, rate);
data = (const char*)data + sizeof(int32_t); data = (const char*)data + sizeof(int32_t);
ss.rate = rate; ss.rate = rate;
@ -779,7 +779,7 @@ static int esd_proto_sample_cache(connection *c, PA_GCC_UNUSED esd_proto_t reque
CHECK_VALIDITY(pa_sample_spec_valid(&ss), "Invalid sample specification."); CHECK_VALIDITY(pa_sample_spec_valid(&ss), "Invalid sample specification.");
memcpy(&sc_length, data, sizeof(int32_t)); memcpy(&sc_length, data, sizeof(int32_t));
sc_length = MAYBE_INT32_SWAP(c->swap_byte_order, sc_length); sc_length = PA_MAYBE_INT32_SWAP(c->swap_byte_order, sc_length);
data = (const char*)data + sizeof(int32_t); data = (const char*)data + sizeof(int32_t);
CHECK_VALIDITY(sc_length <= MAX_CACHE_SAMPLE_SIZE, "Sample too large (%d bytes).", (int)sc_length); CHECK_VALIDITY(sc_length <= MAX_CACHE_SAMPLE_SIZE, "Sample too large (%d bytes).", (int)sc_length);
@ -842,7 +842,7 @@ static int esd_proto_sample_free_or_play(connection *c, esd_proto_t request, con
pa_assert(length == sizeof(int32_t)); pa_assert(length == sizeof(int32_t));
memcpy(&idx, data, sizeof(uint32_t)); memcpy(&idx, data, sizeof(uint32_t));
idx = MAYBE_UINT32_SWAP(c->swap_byte_order, idx) - 1; idx = PA_MAYBE_UINT32_SWAP(c->swap_byte_order, idx) - 1;
ok = 0; ok = 0;
@ -907,7 +907,7 @@ static int do_read(connection *c) {
if ((c->read_data_length+= r) >= sizeof(c->request)) { if ((c->read_data_length+= r) >= sizeof(c->request)) {
struct proto_handler *handler; struct proto_handler *handler;
c->request = MAYBE_INT32_SWAP(c->swap_byte_order, c->request); c->request = PA_MAYBE_INT32_SWAP(c->swap_byte_order, c->request);
if (c->request < ESD_PROTO_CONNECT || c->request > ESD_PROTO_MAX) { if (c->request < ESD_PROTO_CONNECT || c->request > ESD_PROTO_MAX) {
pa_log("recieved invalid request."); pa_log("recieved invalid request.");

View file

@ -208,7 +208,7 @@ size_t pa_mix(
if (cvolume == PA_VOLUME_MUTED) if (cvolume == PA_VOLUME_MUTED)
v = 0; v = 0;
else { else {
v = INT16_SWAP(*((int16_t*) ((uint8_t*) streams[i].internal + streams[i].chunk.index + d))); v = PA_INT16_SWAP(*((int16_t*) ((uint8_t*) streams[i].internal + streams[i].chunk.index + d)));
if (cvolume != PA_VOLUME_NORM) if (cvolume != PA_VOLUME_NORM)
v = (int32_t) (v * pa_sw_volume_to_linear(cvolume)); v = (int32_t) (v * pa_sw_volume_to_linear(cvolume));
@ -223,7 +223,7 @@ size_t pa_mix(
sum = CLAMP(sum, -0x8000, 0x7FFF); sum = CLAMP(sum, -0x8000, 0x7FFF);
} }
*((int16_t*) data) = INT16_SWAP((int16_t) sum); *((int16_t*) data) = PA_INT16_SWAP((int16_t) sum);
data = (uint8_t*) data + sizeof(int16_t); data = (uint8_t*) data + sizeof(int16_t);
if (++channel >= spec->channels) if (++channel >= spec->channels)
@ -398,10 +398,10 @@ void pa_volume_memchunk(
for (channel = 0, d = (int16_t*) ((uint8_t*) ptr + c->index), n = c->length/sizeof(int16_t); n > 0; d++, n--) { for (channel = 0, d = (int16_t*) ((uint8_t*) ptr + c->index), n = c->length/sizeof(int16_t); n > 0; d++, n--) {
int32_t t; int32_t t;
t = (int32_t)(INT16_SWAP(*d)); t = (int32_t)(PA_INT16_SWAP(*d));
t = (t * linear[channel]) / 0x10000; t = (t * linear[channel]) / 0x10000;
t = CLAMP(t, -0x8000, 0x7FFF); t = CLAMP(t, -0x8000, 0x7FFF);
*d = INT16_SWAP((int16_t) t); *d = PA_INT16_SWAP((int16_t) t);
if (++channel >= spec->channels) if (++channel >= spec->channels)
channel = 0; channel = 0;

View file

@ -27,8 +27,8 @@
#include "endianmacros.h" #include "endianmacros.h"
#define INT16_FROM INT16_FROM_BE #define INT16_FROM PA_INT16_FROM_BE
#define INT16_TO INT16_TO_BE #define INT16_TO PA_INT16_TO_BE
#define pa_sconv_s16le_to_float32ne pa_sconv_s16be_to_float32ne #define pa_sconv_s16le_to_float32ne pa_sconv_s16be_to_float32ne
#define pa_sconv_s16le_from_float32ne pa_sconv_s16be_from_float32ne #define pa_sconv_s16le_from_float32ne pa_sconv_s16be_from_float32ne

View file

@ -38,11 +38,11 @@
#include "sconv-s16le.h" #include "sconv-s16le.h"
#ifndef INT16_FROM #ifndef INT16_FROM
#define INT16_FROM INT16_FROM_LE #define INT16_FROM PA_INT16_FROM_LE
#endif #endif
#ifndef INT16_TO #ifndef INT16_TO
#define INT16_TO INT16_TO_LE #define INT16_TO PA_INT16_TO_LE
#endif #endif
#ifndef SWAP_WORDS #ifndef SWAP_WORDS
@ -103,7 +103,7 @@ void pa_sconv_s16le_to_float32re(unsigned n, const int16_t *a, float *b) {
int16_t s = *(a++); int16_t s = *(a++);
float k = ((float) INT16_FROM(s))/0x7FFF; float k = ((float) INT16_FROM(s))/0x7FFF;
uint32_t *j = (uint32_t*) &k; uint32_t *j = (uint32_t*) &k;
*j = UINT32_SWAP(*j); *j = PA_UINT32_SWAP(*j);
*(b++) = k; *(b++) = k;
} }
} }
@ -116,7 +116,7 @@ void pa_sconv_s16le_from_float32re(unsigned n, const float *a, int16_t *b) {
int16_t s; int16_t s;
float v = *(a++); float v = *(a++);
uint32_t *j = (uint32_t*) &v; uint32_t *j = (uint32_t*) &v;
*j = UINT32_SWAP(*j); *j = PA_UINT32_SWAP(*j);
v = CLAMP(v, -1, 1); v = CLAMP(v, -1, 1);
s = (int16_t) (v * 0x7FFF); s = (int16_t) (v * 0x7FFF);
*(b++) = INT16_TO(s); *(b++) = INT16_TO(s);

View file

@ -94,7 +94,7 @@ static void float32re_to_float32ne(unsigned n, const float *a, float *b) {
pa_assert(b); pa_assert(b);
for (; n > 0; n--, a++, b++) for (; n > 0; n--, a++, b++)
*((uint32_t *) b) = UINT32_SWAP(*((uint32_t *) a)); *((uint32_t *) b) = PA_UINT32_SWAP(*((uint32_t *) a));
} }
/* s16 */ /* s16 */
@ -111,7 +111,7 @@ static void s16re_to_s16ne(unsigned n, const int16_t *a, int16_t *b) {
pa_assert(b); pa_assert(b);
for (; n > 0; n--, a++, b++) for (; n > 0; n--, a++, b++)
*b = UINT16_SWAP(*a); *b = PA_UINT16_SWAP(*a);
} }
/* ulaw */ /* ulaw */

View file

@ -38,7 +38,7 @@
static float swap_float(float a) { static float swap_float(float a) {
uint32_t *b = (uint32_t*) &a; uint32_t *b = (uint32_t*) &a;
*b = UINT32_SWAP(*b); *b = PA_UINT32_SWAP(*b);
return a; return a;
} }