Add a system-wide BIT_N macro, implemented via an LUT on SH, and use it in the TAGCACHE_IS_* macros in place of per-set LUTs, removing duplication of data between those LUTs and the mask values used on other targets.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21195 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Andrew Mahone 2009-06-06 00:00:58 +00:00
parent fe72c890a7
commit de7c5711c5
5 changed files with 29 additions and 31 deletions

View file

@ -27,6 +27,17 @@
#include "font.h"
#include "led.h"
const unsigned bit_n_table[32] = {
1LU<< 0, 1LU<< 1, 1LU<< 2, 1LU<< 3,
1LU<< 4, 1LU<< 5, 1LU<< 6, 1LU<< 7,
1LU<< 8, 1LU<< 9, 1LU<<10, 1LU<<11,
1LU<<12, 1LU<<13, 1LU<<14, 1LU<<15,
1LU<<16, 1LU<<17, 1LU<<18, 1LU<<19,
1LU<<20, 1LU<<21, 1LU<<22, 1LU<<23,
1LU<<24, 1LU<<25, 1LU<<26, 1LU<<27,
1LU<<28, 1LU<<29, 1LU<<30, 1LU<<31
};
static const char* const irqname[] = {
"", "", "", "", "IllInstr", "", "IllSltIn","","",
"CPUAdrEr", "DMAAdrEr", "NMI", "UserBrk",

View file

@ -126,4 +126,11 @@ static inline uint32_t swap_odd_even32(uint32_t value)
return value;
}
extern const unsigned bit_n_table[32];
#define BIT_N(n) ( \
__builtin_constant_p(n) \
? (1LU << (n)) \
: bit_n_table[n] \
)
#endif /* SYSTEM_TARGET_H */