mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
Convert a number of places in core and plugins to use the BIT_N() macro instead of 1<<n. Speeds up things on SH1, and also reduces core binsize. Most notable speedups: 1 bit lcd driver: drawpixel +20%, drawline + 27%, hline +5%; jpeg viewer: +8% for 1/8 scaling. Other targets are unaffected.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21205 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
c3182ec333
commit
1d6df54df2
24 changed files with 88 additions and 70 deletions
|
@ -669,16 +669,16 @@ void dump_packet(char* dest, int dst_size, char* src, int n)
|
|||
|
||||
bool bit_test(unsigned char* buf, unsigned bit)
|
||||
{
|
||||
return (buf[bit/4] & (0x01 << bit%4)) != 0;
|
||||
return (buf[bit>>2] & BIT_N(bit&3)) != 0;
|
||||
}
|
||||
|
||||
|
||||
void bit_set(unsigned char* buf, unsigned bit, bool val)
|
||||
{
|
||||
if (val)
|
||||
buf[bit/4] |= (0x01 << bit%4);
|
||||
buf[bit>>2] |= BIT_N(bit&3);
|
||||
else
|
||||
buf[bit/4] &= ~(0x01 << bit%4);
|
||||
buf[bit>>2] &= ~BIT_N(bit&3);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue