From 94e774a8bd2891f36885ae710efd42caebd855ed Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 8 Apr 2011 13:49:11 +0200 Subject: 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. --- fitz/filt_predict.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'fitz/filt_predict.c') 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; -- cgit v1.2.3