Mercurial > hg > xemacs-beta
comparison src/miscplay.c @ 442:abe6d1db359e r21-2-36
Import from CVS: tag r21-2-36
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:35:02 +0200 |
parents | a5df635868b2 |
children | 576fb035e263 |
comparison
equal
deleted
inserted
replaced
441:72a7cfa4a488 | 442:abe6d1db359e |
---|---|
30 | 30 |
31 #ifdef __GNUC__ | 31 #ifdef __GNUC__ |
32 #define UNUSED(x) ((void)(x)) | 32 #define UNUSED(x) ((void)(x)) |
33 #else | 33 #else |
34 #define UNUSED(x) | 34 #define UNUSED(x) |
35 #define __inline__ | |
36 #endif | 35 #endif |
37 | 36 |
38 /* Maintain global variable for keeping parser state information; this struct | 37 /* Maintain global variable for keeping parser state information; this struct |
39 is set to zero before the first invocation of the parser. The use of a | 38 is set to zero before the first invocation of the parser. The use of a |
40 global variable prevents multiple concurrent executions of this code, but | 39 global variable prevents multiple concurrent executions of this code, but |
112 | 111 |
113 /* We need to perform some look-ahead in order to parse files in WAVE format; | 112 /* We need to perform some look-ahead in order to parse files in WAVE format; |
114 this might require re-partioning of the data segments if headers cross the | 113 this might require re-partioning of the data segments if headers cross the |
115 boundaries between two read operations. This is done in a two-step way: | 114 boundaries between two read operations. This is done in a two-step way: |
116 first we request a certain amount of bytes... */ | 115 first we request a certain amount of bytes... */ |
117 static __inline__ int waverequire(void **data,size_t *sz,size_t rq) | 116 static inline int waverequire(void **data,size_t *sz,size_t rq) |
118 { | 117 { |
119 int rc = 1; | 118 int rc = 1; |
120 | 119 |
121 if (rq > HEADERSZ) { | 120 if (rq > HEADERSZ) { |
122 warn("Header size exceeded while parsing WAVE file"); | 121 warn("Header size exceeded while parsing WAVE file"); |
133 *sz -= rq; | 132 *sz -= rq; |
134 return(rc); | 133 return(rc); |
135 } | 134 } |
136 | 135 |
137 /* ...and next we remove this many bytes from the buffer */ | 136 /* ...and next we remove this many bytes from the buffer */ |
138 static __inline__ void waveremove(size_t rq) | 137 static inline void waveremove(size_t rq) |
139 { | 138 { |
140 if (parsestate.wave.left <= rq) | 139 if (parsestate.wave.left <= rq) |
141 parsestate.wave.left = 0; | 140 parsestate.wave.left = 0; |
142 else { | 141 else { |
143 parsestate.wave.left -= rq; | 142 parsestate.wave.left -= rq; |
429 return(rc); | 428 return(rc); |
430 } | 429 } |
431 | 430 |
432 /* Convert a number in the range -32768..32767 to an 8 bit ulaw encoded | 431 /* Convert a number in the range -32768..32767 to an 8 bit ulaw encoded |
433 number --- I hope, I got this conversion right :-) */ | 432 number --- I hope, I got this conversion right :-) */ |
434 static __inline__ signed char int2ulaw(int i) | 433 static inline signed char int2ulaw(int i) |
435 { | 434 { |
436 /* Lookup table for fast calculation of number of bits that need shifting*/ | 435 /* Lookup table for fast calculation of number of bits that need shifting*/ |
437 static short int t_bits[128] = { | 436 static short int t_bits[128] = { |
438 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, | 437 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, |
439 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, | 438 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, |