diff options
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/jpeg.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/apps/plugins/jpeg.c b/apps/plugins/jpeg.c index 5ecd394d26..9a32a8c6ca 100644 --- a/apps/plugins/jpeg.c +++ b/apps/plugins/jpeg.c | |||
@@ -200,12 +200,11 @@ INLINE unsigned range_limit(int value) | |||
200 | ); | 200 | ); |
201 | return value; | 201 | return value; |
202 | #elif defined(CPU_ARM) | 202 | #elif defined(CPU_ARM) |
203 | asm ( | 203 | asm ( /* Note: Uses knowledge that only the low byte of the result is used */ |
204 | "adds %[v], %[v], #128\n" /* value += 128 */ | 204 | "add %[v], %[v], #128 \n" /* value += 128 */ |
205 | "movmi %[v], #0 \n" /* clip to 0 if negative result */ | 205 | "cmp %[v], #255 \n" /* out of range 0..255? */ |
206 | "cmp %[v], #255 \n" /* did we exceed 255? */ | 206 | "mvnhi %[v], %[v], asr #31 \n" /* yes: set all bits to ~(sign_bit) */ |
207 | "movgt %[v], #255 \n" /* yes, clip to limit */ | 207 | : /* outputs */ |
208 | : | ||
209 | [v]"+r"(value) | 208 | [v]"+r"(value) |
210 | ); | 209 | ); |
211 | return value; | 210 | return value; |