1
0
Fork 0
forked from len0rd/rockbox

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:
Jens Arnold 2009-06-07 21:27:05 +00:00
parent c3182ec333
commit 1d6df54df2
24 changed files with 88 additions and 70 deletions

View file

@ -1268,7 +1268,7 @@ static int set_multiple_mode(int sectors)
#ifdef HAVE_ATA_DMA
static int get_best_mode(unsigned short identword, int max, int modetype)
{
unsigned short testbit = 1u << max;
unsigned short testbit = BIT_N(max);
while (1) {
if (identword & testbit)
@ -1335,7 +1335,7 @@ static int set_features(void)
}
for (i=0; i < (int)(sizeof(features)/sizeof(features[0])); i++) {
if (identify_info[features[i].id_word] & (1u << features[i].id_bit)) {
if (identify_info[features[i].id_word] & BIT_N(features[i].id_bit)) {
SET_REG(ATA_FEATURE, features[i].subcommand);
SET_REG(ATA_NSECTOR, features[i].parameter);
SET_REG(ATA_COMMAND, CMD_SET_FEATURES);
@ -1461,7 +1461,7 @@ int ata_init(void)
#ifdef MAX_PHYS_SECTOR_SIZE
/* Find out the physical sector size */
if((identify_info[106] & 0xe000) == 0x6000)
phys_sector_mult = 1 << (identify_info[106] & 0x000f);
phys_sector_mult = BIT_N(identify_info[106] & 0x000f);
else
phys_sector_mult = 1;