summaryrefslogtreecommitdiff
path: root/firmware/target/coldfire/system-target.h
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2011-01-30 00:58:45 +0000
committerMichael Sevakis <jethead71@rockbox.org>2011-01-30 00:58:45 +0000
commit18770dac2e560c88daa3ca9944917be561c3548f (patch)
tree5adf8aef7cb7999a6e07ddefcbb9e1d9bf18a15c /firmware/target/coldfire/system-target.h
parentc0c769c5a86c56c2ab2c9e88515a64da98575182 (diff)
downloadrockbox-18770dac2e560c88daa3ca9944917be561c3548f.tar.gz
rockbox-18770dac2e560c88daa3ca9944917be561c3548f.zip
Use __builtin_constant_p() to select the best byteswapping method: constant or target optimized. Same macro can then be used for constant values and inits as well as non-constant.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29171 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/coldfire/system-target.h')
-rw-r--r--firmware/target/coldfire/system-target.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/firmware/target/coldfire/system-target.h b/firmware/target/coldfire/system-target.h
index 2de8fd06c2..d1a2a1f115 100644
--- a/firmware/target/coldfire/system-target.h
+++ b/firmware/target/coldfire/system-target.h
@@ -132,7 +132,7 @@ static inline void restore_irq(int oldlevel)
132 asm volatile ("move.w %0, %%sr" : : "d"(oldlevel)); 132 asm volatile ("move.w %0, %%sr" : : "d"(oldlevel));
133} 133}
134 134
135static inline uint16_t swap16(uint16_t value) 135static inline uint16_t swap16_hw(uint16_t value)
136 /* 136 /*
137 result[15..8] = value[ 7..0]; 137 result[15..8] = value[ 7..0];
138 result[ 7..0] = value[15..8]; 138 result[ 7..0] = value[15..8];
@@ -141,7 +141,7 @@ static inline uint16_t swap16(uint16_t value)
141 return (value >> 8) | (value << 8); 141 return (value >> 8) | (value << 8);
142} 142}
143 143
144static inline uint32_t SWAW32(uint32_t value) 144static inline uint32_t swaw32_hw(uint32_t value)
145 /* 145 /*
146 result[31..16] = value[15.. 0]; 146 result[31..16] = value[15.. 0];
147 result[15.. 0] = value[31..16]; 147 result[15.. 0] = value[31..16];
@@ -151,7 +151,7 @@ static inline uint32_t SWAW32(uint32_t value)
151 return value; 151 return value;
152} 152}
153 153
154static inline uint32_t swap32(uint32_t value) 154static inline uint32_t swap32_hw(uint32_t value)
155 /* 155 /*
156 result[31..24] = value[ 7.. 0]; 156 result[31..24] = value[ 7.. 0];
157 result[23..16] = value[15.. 8]; 157 result[23..16] = value[15.. 8];
@@ -174,7 +174,7 @@ static inline uint32_t swap32(uint32_t value)
174 return value; 174 return value;
175} 175}
176 176
177static inline uint32_t swap_odd_even32(uint32_t value) 177static inline uint32_t swap_odd_even32_hw(uint32_t value)
178{ 178{
179 /* 179 /*
180 result[31..24],[15.. 8] = value[23..16],[ 7.. 0] 180 result[31..24],[15.. 8] = value[23..16],[ 7.. 0]