diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2011-04-08 13:49:11 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2011-04-08 13:49:11 +0200 |
commit | 94e774a8bd2891f36885ae710efd42caebd855ed (patch) | |
tree | 883147e1bf5dc8feba5d142b8ffcde8e7e0676f6 /fitz/filt_predict.c | |
parent | a1b5f023ccebd339e9a74ef7f3bcc94c0c74d3e0 (diff) | |
download | mupdf-94e774a8bd2891f36885ae710efd42caebd855ed.tar.xz |
Remove inline keyword where it is not strictly necessary for performance.
Also put the function on the same line for inline functions, so
they stick out and are easy to find with grep.
Diffstat (limited to 'fitz/filt_predict.c')
-rw-r--r-- | fitz/filt_predict.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/fitz/filt_predict.c b/fitz/filt_predict.c index 1501fc09..94f2718a 100644 --- a/fitz/filt_predict.c +++ b/fitz/filt_predict.c @@ -23,33 +23,31 @@ struct fz_predict_s unsigned char *rp, *wp; }; -static inline int -getcomponent(unsigned char *buf, int x, int bpc) +static inline int getcomponent(unsigned char *line, int x, int bpc) { switch (bpc) { - case 1: return buf[x / 8] >> (7 - (x % 8)) & 0x01; - case 2: return buf[x / 4] >> ((3 - (x % 4)) * 2) & 0x03; - case 4: return buf[x / 2] >> ((1 - (x % 2)) * 4) & 0x0f; - case 8: return buf[x]; + case 1: return (line[x >> 3] >> ( 7 - (x & 7) ) ) & 1; + case 2: return (line[x >> 2] >> ( ( 3 - (x & 3) ) << 1 ) ) & 3; + case 4: return (line[x >> 1] >> ( ( 1 - (x & 1) ) << 2 ) ) & 15; + case 8: return line[x]; } return 0; } -static inline void -putcomponent(unsigned char *buf, int x, int bpc, int value) + +static inline void putcomponent(unsigned char *buf, int x, int bpc, int value) { switch (bpc) { - case 1: buf[x / 8] |= value << (7 - (x % 8)); break; - case 2: buf[x / 4] |= value << ((3 - (x % 4)) * 2); break; - case 4: buf[x / 2] |= value << ((1 - (x % 2)) * 4); break; + case 1: buf[x >> 3] |= value << (7 - (x & 7)); break; + case 2: buf[x >> 2] |= value << ((3 - (x & 3)) << 1); break; + case 4: buf[x >> 1] |= value << ((1 - (x & 1)) << 2); break; case 8: buf[x] = value; break; } } -static inline int -paeth(int a, int b, int c) +static inline int paeth(int a, int b, int c) { /* The definitions of ac and bc are correct, not a typo. */ int ac = b - c, bc = a - c, abcc = ac + bc; |