diff options
author | Andrew Mahone <andrew.mahone@gmail.com> | 2009-06-06 00:00:58 +0000 |
---|---|---|
committer | Andrew Mahone <andrew.mahone@gmail.com> | 2009-06-06 00:00:58 +0000 |
commit | de7c5711c5d67e7e69386d6e35e42c8ce15de69b (patch) | |
tree | 22f58338387ae6ac662e43fe83ef60105f97d627 /firmware/target/sh | |
parent | fe72c890a76c1f227ef749adbdcf964bb166d74c (diff) | |
download | rockbox-de7c5711c5d67e7e69386d6e35e42c8ce15de69b.tar.gz rockbox-de7c5711c5d67e7e69386d6e35e42c8ce15de69b.zip |
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
Diffstat (limited to 'firmware/target/sh')
-rw-r--r-- | firmware/target/sh/system-sh.c | 11 | ||||
-rw-r--r-- | firmware/target/sh/system-target.h | 7 |
2 files changed, 18 insertions, 0 deletions
diff --git a/firmware/target/sh/system-sh.c b/firmware/target/sh/system-sh.c index 02af40282f..7779c975a7 100644 --- a/firmware/target/sh/system-sh.c +++ b/firmware/target/sh/system-sh.c | |||
@@ -27,6 +27,17 @@ | |||
27 | #include "font.h" | 27 | #include "font.h" |
28 | #include "led.h" | 28 | #include "led.h" |
29 | 29 | ||
30 | const unsigned bit_n_table[32] = { | ||
31 | 1LU<< 0, 1LU<< 1, 1LU<< 2, 1LU<< 3, | ||
32 | 1LU<< 4, 1LU<< 5, 1LU<< 6, 1LU<< 7, | ||
33 | 1LU<< 8, 1LU<< 9, 1LU<<10, 1LU<<11, | ||
34 | 1LU<<12, 1LU<<13, 1LU<<14, 1LU<<15, | ||
35 | 1LU<<16, 1LU<<17, 1LU<<18, 1LU<<19, | ||
36 | 1LU<<20, 1LU<<21, 1LU<<22, 1LU<<23, | ||
37 | 1LU<<24, 1LU<<25, 1LU<<26, 1LU<<27, | ||
38 | 1LU<<28, 1LU<<29, 1LU<<30, 1LU<<31 | ||
39 | }; | ||
40 | |||
30 | static const char* const irqname[] = { | 41 | static const char* const irqname[] = { |
31 | "", "", "", "", "IllInstr", "", "IllSltIn","","", | 42 | "", "", "", "", "IllInstr", "", "IllSltIn","","", |
32 | "CPUAdrEr", "DMAAdrEr", "NMI", "UserBrk", | 43 | "CPUAdrEr", "DMAAdrEr", "NMI", "UserBrk", |
diff --git a/firmware/target/sh/system-target.h b/firmware/target/sh/system-target.h index 3c225fbb69..2568911a1e 100644 --- a/firmware/target/sh/system-target.h +++ b/firmware/target/sh/system-target.h | |||
@@ -126,4 +126,11 @@ static inline uint32_t swap_odd_even32(uint32_t value) | |||
126 | return value; | 126 | return value; |
127 | } | 127 | } |
128 | 128 | ||
129 | extern const unsigned bit_n_table[32]; | ||
130 | #define BIT_N(n) ( \ | ||
131 | __builtin_constant_p(n) \ | ||
132 | ? (1LU << (n)) \ | ||
133 | : bit_n_table[n] \ | ||
134 | ) | ||
135 | |||
129 | #endif /* SYSTEM_TARGET_H */ | 136 | #endif /* SYSTEM_TARGET_H */ |