don't use short chunk numbers

Don't be mean with integer sizes.  Although we will probably never
have more than 32k buffered chunks, we should use 32 bit integers for
addressing them.  We do not save very much (some of the saved space is
eaten by alignment anyway), but we save at least one assembler
instruction for converting short to int.

This change requires some more explicit casts, because gcc was less
picky when comparing short with a full int.

git-svn-id: https://svn.musicpd.org/mpd/trunk@7313 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
Max Kellermann 2008-04-12 04:18:28 +00:00 committed by Eric Wong
parent 20c4638a2e
commit 0c46dd6831
3 changed files with 7 additions and 7 deletions

View File

@ -518,7 +518,7 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer *
if (do_pause)
player_sleep();
else if (!outputBufferEmpty(cb) && cb->begin != next) {
else if (!outputBufferEmpty(cb) && (int)cb->begin != next) {
OutputBufferChunk *beginChunk =
outputBufferGetChunk(cb, cb->begin);
unsigned int fadePosition;
@ -564,7 +564,7 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer *
break;
outputBufferShift(cb);
player_wakeup_decoder_nb();
} else if (!outputBufferEmpty(cb) && cb->begin == next) {
} else if (!outputBufferEmpty(cb) && (int)cb->begin == next) {
/* at the beginning of a new song */
if (doCrossFade == 1 && nextChunk >= 0) {

View File

@ -53,7 +53,7 @@ static inline unsigned successor(const OutputBuffer * cb, unsigned i)
void flushOutputBuffer(OutputBuffer * cb)
{
if (cb->currentChunk == cb->end) {
if (cb->currentChunk == (int)cb->end) {
cb->end = successor(cb, cb->end);
cb->currentChunk = -1;
}
@ -125,7 +125,7 @@ static int tailChunk(OutputBuffer * cb, InputStream * inStream,
unsigned int next;
OutputBufferChunk *chunk;
if (cb->currentChunk == cb->end)
if (cb->currentChunk == (int)cb->end)
return cb->currentChunk;
next = successor(cb, cb->end);

View File

@ -49,12 +49,12 @@ typedef struct _OutputBuffer {
unsigned int size;
/** the index of the first decoded chunk */
mpd_uint16 volatile begin;
unsigned int volatile begin;
/** the index after the last decoded chunk */
mpd_uint16 volatile end;
unsigned int volatile end;
mpd_sint16 currentChunk;
int currentChunk;
AudioFormat audioFormat;
ConvState convState;