[libpng15] Renamed the LSR() macro to PNG_LSR() and added PNG_LSL() macro.
diff --git a/ANNOUNCE b/ANNOUNCE
index b08f0f6..b4bfe67 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -97,6 +97,7 @@
code branches and complain about out-of-range shifts.
Version 1.5.6rc03 [October 27, 2011]
+ Renamed the LSR() macro to PNG_LSR() and added PNG_LSL() macro.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net:
(subscription required; visit
diff --git a/CHANGES b/CHANGES
index ff7f7ef..4b448f6 100644
--- a/CHANGES
+++ b/CHANGES
@@ -3658,6 +3658,7 @@
code branches and complain about out-of-range shifts.
Version 1.5.6rc03 [October 27, 2011]
+ Renamed the LSR() macro to PNG_LSR() and added PNG_LSL() macro.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
diff --git a/pngrutil.c b/pngrutil.c
index 374dfeb..a7b584d 100644
--- a/pngrutil.c
+++ b/pngrutil.c
@@ -2880,16 +2880,20 @@
* below to extract the relevant fields from a 64 bit value are faulted
* if evaluated at compile time because the non-taken branch has an
* invalid shift (negative or more than 31), hence the following.
- */
+ *
+ * TO DO: Also identify the Intel C compiler here.
+ */
# if defined PNG_USE_COMPILE_TIME_MASKS && defined _MSC_VER
-# define LSR(x,s) ((x)>>((s) & 0x1f))
+# define PNG_LSR(x,s) ((x)>>((s) & 0x1f))
+# define PNG_LSL(x,s) ((x)<<((s) & 0x1f))
# else
-# define LSR(x,s) ((x)>>(s))
+# define PNG_LSR(x,s) ((x)>>(s))
+# define PNG_LSL(x,s) ((x)<<(s))
# endif
-# define S_COPY(p,x) (((p)<4 ? LSR(0x80088822,(3-(p))*8+(7-(x))) :\
- LSR(0xaa55ff00,(7-(p))*8+(7-(x)))) & 1)
-# define B_COPY(p,x) (((p)<4 ? LSR(0xff0fff33,(3-(p))*8+(7-(x))) :\
- LSR(0xff55ff00,(7-(p))*8+(7-(x)))) & 1)
+# define S_COPY(p,x) (((p)<4 ? PNG_LSR(0x80088822,(3-(p))*8+(7-(x))) :\
+ PNG_LSR(0xaa55ff00,(7-(p))*8+(7-(x)))) & 1)
+# define B_COPY(p,x) (((p)<4 ? PNG_LSR(0xff0fff33,(3-(p))*8+(7-(x))) :\
+ PNG_LSR(0xff55ff00,(7-(p))*8+(7-(x)))) & 1)
/* Return a mask for pass 'p' pixel 'x' at depth 'd'. The mask is
* little endian - the first pixel is at bit 0 - however the extra
@@ -2897,7 +2901,8 @@
* within each byte, to match the PNG format. This is done by XOR of
* the shift with 7, 6 or 4 for bit depths 1, 2 and 4.
*/
-# define PIXEL_MASK(p,x,d,s) (((1U<<(d))-1)<<(((x)*(d))^((s)?8-(d):0)))
+# define PIXEL_MASK(p,x,d,s) \
+ (PNG_LSL(((PNG_LSL(1U,(d)))-1),(((x)*(d))^((s)?8-(d):0))))
/* Hence generate the appropriate 'block' or 'sparkle' pixel copy mask.
*/