summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorNils Wallménius <nils@rockbox.org>2008-11-22 16:56:20 +0000
committerNils Wallménius <nils@rockbox.org>2008-11-22 16:56:20 +0000
commit95cf600b6cbc4529a181ab8f60b552138d998a03 (patch)
tree0e9e8a543f9ce498a9b59b22051b3de860bf8db8 /apps
parent5dfde5c80b7450aa6c1b25257f90ae62d471065f (diff)
Macros should be ALL CAPS, so rename (un)likely() to (UN)LIKELY()
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19181 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/codecs/libtremor/codebook.c10
-rw-r--r--apps/plugins/midi/synth.c36
-rw-r--r--apps/plugins/mpegplayer/attributes.h8
3 files changed, 31 insertions, 23 deletions
diff --git a/apps/codecs/libtremor/codebook.c b/apps/codecs/libtremor/codebook.c
index 5ffd0e308b..f291686870 100644
--- a/apps/codecs/libtremor/codebook.c
+++ b/apps/codecs/libtremor/codebook.c
@@ -154,9 +154,9 @@ STIN long decode_packed_entry_number(codebook *book,
long lo,hi;
long lok = oggpack_look(b,book->dec_firsttablen);
- if (likely(lok >= 0)) {
+ if (LIKELY(lok >= 0)) {
long entry = book->dec_firsttable[lok];
- if(unlikely(entry&0x80000000UL)){
+ if(UNLIKELY(entry&0x80000000UL)){
lo=(entry>>15)&0x7fff;
hi=book->used_entries-(entry&0x7fff);
}else{
@@ -218,7 +218,7 @@ static long decode_packed_block(codebook *book, oggpack_buffer *b,
bitend = ((adr&3)+b->headend)*8;
while (bufptr<bufend){
long entry, lo, hi;
- if (unlikely(cachesize<book->dec_maxlength)) {
+ if (UNLIKELY(cachesize<book->dec_maxlength)) {
if (bit-cachesize+32>=bitend)
break;
bit-=cachesize;
@@ -230,13 +230,13 @@ static long decode_packed_block(codebook *book, oggpack_buffer *b,
}
entry=book->dec_firsttable[cache&((1<<book->dec_firsttablen)-1)];
- if(unlikely(entry&0x80000000UL)){
+ if(UNLIKELY(entry&0x80000000UL)){
lo=(entry>>15)&0x7fff;
hi=book->used_entries-(entry&0x7fff);
{
ogg_uint32_t testword=bitreverse((ogg_uint32_t)cache);
- while(likely(hi-lo>1)){
+ while(LIKELY(hi-lo>1)){
long p=(hi-lo)>>1;
if (book->codelist[lo+p]>testword)
hi-=p;
diff --git a/apps/plugins/midi/synth.c b/apps/plugins/midi/synth.c
index 7e283d4ef1..969d9b939a 100644
--- a/apps/plugins/midi/synth.c
+++ b/apps/plugins/midi/synth.c
@@ -293,10 +293,10 @@ static inline void synthVoice(struct SynthObject * so, int32_t * out, unsigned i
const unsigned int start_loop = wf->startLoop << FRACTSIZE;
const int diff_loop = end_loop-start_loop;
- while(likely(samples-- > 0))
+ while(LIKELY(samples-- > 0))
{
/* Is voice being ramped? */
- if(unlikely(so->state == STATE_RAMPDOWN))
+ if(UNLIKELY(so->state == STATE_RAMPDOWN))
{
if(so->decay != 0) /* Ramp has been started */
{
@@ -318,12 +318,12 @@ static inline void synthVoice(struct SynthObject * so, int32_t * out, unsigned i
s2 = getSample((cp_temp >> FRACTSIZE)+1, wf);
- if(likely(mode_mask28))
+ if(LIKELY(mode_mask28))
{
/* LOOP_REVERSE|LOOP_PINGPONG = 24 */
- if(unlikely(mode_mask24 && so->loopState == STATE_LOOPING && (cp_temp < start_loop)))
+ if(UNLIKELY(mode_mask24 && so->loopState == STATE_LOOPING && (cp_temp < start_loop)))
{
- if(unlikely(mode_mask_looprev))
+ if(UNLIKELY(mode_mask_looprev))
{
cp_temp += diff_loop;
s2=getSample((cp_temp >> FRACTSIZE), wf);
@@ -334,10 +334,10 @@ static inline void synthVoice(struct SynthObject * so, int32_t * out, unsigned i
}
}
- if(unlikely(cp_temp >= end_loop))
+ if(UNLIKELY(cp_temp >= end_loop))
{
so->loopState = STATE_LOOPING;
- if(unlikely(!mode_mask24))
+ if(UNLIKELY(!mode_mask24))
{
cp_temp -= diff_loop;
s2=getSample((cp_temp >> FRACTSIZE), wf);
@@ -350,7 +350,7 @@ static inline void synthVoice(struct SynthObject * so, int32_t * out, unsigned i
}
/* Have we overrun? */
- if(unlikely(cp_temp >= num_samples))
+ if(UNLIKELY(cp_temp >= num_samples))
{
cp_temp -= so->delta;
s2 = getSample((cp_temp >> FRACTSIZE)+1, wf);
@@ -362,21 +362,21 @@ static inline void synthVoice(struct SynthObject * so, int32_t * out, unsigned i
s1 +=((signed)((s2 - s1) * (cp_temp & ((1<<FRACTSIZE)-1)))>>FRACTSIZE);
- if(unlikely(so->curRate == 0))
+ if(UNLIKELY(so->curRate == 0))
{
stopVoice(so);
// so->isUsed = false;
}
- if(likely(so->ch != 9 && so->state != STATE_RAMPDOWN)) /* Stupid ADSR code... and don't do ADSR for drums */
+ if(LIKELY(so->ch != 9 && so->state != STATE_RAMPDOWN)) /* Stupid ADSR code... and don't do ADSR for drums */
{
- if(unlikely(so->curOffset < so->targetOffset))
+ if(UNLIKELY(so->curOffset < so->targetOffset))
{
so->curOffset += (so->curRate);
- if(unlikely(so -> curOffset > so->targetOffset && so->curPoint != 2))
+ if(UNLIKELY(so -> curOffset > so->targetOffset && so->curPoint != 2))
{
- if(unlikely(so->curPoint != 5))
+ if(UNLIKELY(so->curPoint != 5))
{
setPoint(so, so->curPoint+1);
}
@@ -388,9 +388,9 @@ static inline void synthVoice(struct SynthObject * so, int32_t * out, unsigned i
} else
{
so->curOffset -= (so->curRate);
- if(unlikely(so -> curOffset < so->targetOffset && so->curPoint != 2))
+ if(UNLIKELY(so -> curOffset < so->targetOffset && so->curPoint != 2))
{
- if(unlikely(so->curPoint != 5))
+ if(UNLIKELY(so->curPoint != 5))
{
setPoint(so, so->curPoint+1);
}
@@ -403,7 +403,7 @@ static inline void synthVoice(struct SynthObject * so, int32_t * out, unsigned i
}
}
- if(unlikely(so->curOffset < 0))
+ if(UNLIKELY(so->curOffset < 0))
{
so->curOffset = so->targetOffset;
stopVoice(so);
@@ -416,7 +416,7 @@ static inline void synthVoice(struct SynthObject * so, int32_t * out, unsigned i
s1 = s1 * volscale >> 14;
/* need to set ramp beginning */
- if(unlikely(so->state == STATE_RAMPDOWN && so->decay == 0))
+ if(UNLIKELY(so->state == STATE_RAMPDOWN && so->decay == 0))
{
so->decay = s1;
if(so->decay == 0)
@@ -442,7 +442,7 @@ int32_t samp_buf[512] IBSS_ATTR;
void synthSamples(int32_t *buf_ptr, unsigned int num_samples) ICODE_ATTR;
void synthSamples(int32_t *buf_ptr, unsigned int num_samples)
{
- if (unlikely(num_samples > 512))
+ if (UNLIKELY(num_samples > 512))
DEBUGF("num_samples is too big!\n");
else
{
diff --git a/apps/plugins/mpegplayer/attributes.h b/apps/plugins/mpegplayer/attributes.h
index 7ad83a3e6e..24b069223b 100644
--- a/apps/plugins/mpegplayer/attributes.h
+++ b/apps/plugins/mpegplayer/attributes.h
@@ -32,3 +32,11 @@
#define ATTR_ALIGN(align)
#endif
+#if defined(LIKELY) && defined (UNLIKELY)
+#define likely(x) LIKELY(x)
+#define unlikely(x) UNLIKELY(x)
+#else
+#define likely(x) (x)
+#define unlikely(x) (x)
+#endif
+