diff options
-rw-r--r-- | mupdf/pdf_function.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/mupdf/pdf_function.c b/mupdf/pdf_function.c index f937963f..2a248f46 100644 --- a/mupdf/pdf_function.c +++ b/mupdf/pdf_function.c @@ -1065,19 +1065,19 @@ loadsamplefunc(pdf_function *func, pdf_xref *xref, fz_obj *dict, int num, int ge if (bps == 1) { int x = fz_peekbyte(stream); - s = (x >> (7 - (i & 0x7))) & 0x01; + s = (x >> ( 7 - (i & 7) ) ) & 1; if ((i & 0x07) == 7) fz_readbyte(stream); } else if (bps == 2) { int x = fz_peekbyte(stream); - s = ((x >> (3 - (i & 0x3))) & 0x03) / 4.0f; + s = ((x >> ( ( 3 - (i & 3) ) << 1 ) ) & 3 ) / 3.0f; if ((i & 0x3) == 3) fz_readbyte(stream); } else if (bps == 4) { int x = fz_peekbyte(stream); - s = ((x >> (1 - (i & 0x1))) & 0x0f) / 16.0f; + s = ((x >> ( ( 1 - (i & 1) ) << 2 ) ) & 15 ) / 15.0f; if ((i & 0x1) == 1) fz_readbyte(stream); } @@ -1094,7 +1094,7 @@ loadsamplefunc(pdf_function *func, pdf_xref *xref, fz_obj *dict, int num, int ge unsigned int x = fz_readbyte(stream); x = (x << 8) + fz_readbyte(stream); x = (x << 8) + fz_readbyte(stream); - s = x / 16777216.0f; + s = x / 16777215.0f; } else if (bps == 32) { unsigned int x = fz_readbyte(stream); |