From f3dddb5e99335e0cbfd178a02df0087db415e5de Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 21 Jan 2008 14:33:42 -0800 Subject: Remove unnecessary duplicate thunk lookups --- Alc/ALu.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/Alc/ALu.c b/Alc/ALu.c index 1d202f54..8a5ae3de 100644 --- a/Alc/ALu.c +++ b/Alc/ALu.c @@ -700,22 +700,20 @@ ALvoid aluMixData(ALCcontext *ALContext,ALvoid *buffer,ALsizei size,ALenum forma { if (BufferListItem->next) { - if(BufferListItem->next->buffer && - ((ALbuffer*)ALTHUNK_LOOKUPENTRY(BufferListItem->next->buffer))->data) + ALbuffer *NextBuf = (ALbuffer*)ALTHUNK_LOOKUPENTRY(BufferListItem->next->buffer); + if(NextBuf && NextBuf->data) { - ulExtraSamples = min(((ALbuffer*)ALTHUNK_LOOKUPENTRY(BufferListItem->next->buffer))->size, (ALint)(16*Channels)); - memcpy(&Data[DataSize*Channels], ((ALbuffer*)ALTHUNK_LOOKUPENTRY(BufferListItem->next->buffer))->data, ulExtraSamples); + ulExtraSamples = min(NextBuf->size, (ALint)(16*Channels)); + memcpy(&Data[DataSize*Channels], NextBuf->data, ulExtraSamples); } } else if (ALSource->bLooping) { - if (ALSource->queue->buffer) + ALbuffer *NextBuf = (ALbuffer*)ALTHUNK_LOOKUPENTRY(ALSource->queue->buffer); + if (NextBuf && NextBuf->data) { - if(((ALbuffer*)ALTHUNK_LOOKUPENTRY(ALSource->queue->buffer))->data) - { - ulExtraSamples = min(((ALbuffer*)ALTHUNK_LOOKUPENTRY(ALSource->queue->buffer))->size, (ALint)(16*Channels)); - memcpy(&Data[DataSize*Channels], ((ALbuffer*)ALTHUNK_LOOKUPENTRY(ALSource->queue->buffer))->data, ulExtraSamples); - } + ulExtraSamples = min(NextBuf->size, (ALint)(16*Channels)); + memcpy(&Data[DataSize*Channels], NextBuf->data, ulExtraSamples); } } } -- cgit v1.2.3