[Pixman] [PATCH] [dither] Don't use GNU extension for binary numbers

basile-pixman at clement.pm basile-pixman at clement.pm
Mon Jun 10 11:57:22 UTC 2019


From: Basile Clement <basile-pixman at clement.pm>

The dithering code (specifically `dither_factor_bayer_8`) uses a GNU
extension for binary notation, eg 0b001.  This is not supported by MSVC
(at least) and breaks the build on this platform [1].

This patches uses hexadecimal notation instead, fixing the build.

[1]: https://lists.freedesktop.org/archives/pixman/2019-June/004883.html
---
 pixman/pixman-bits-image.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pixman/pixman-bits-image.c b/pixman/pixman-bits-image.c
index eb8794a..1ecbe54 100644
--- a/pixman/pixman-bits-image.c
+++ b/pixman/pixman-bits-image.c
@@ -1066,9 +1066,9 @@ dither_factor_bayer_8 (int x, int y)
     /* Compute reverse(interleave(xor(x mod n, y mod n), x mod n))
      * Here n = 8 and `mod n` is the bottom 3 bits.
      */
-    m = ((y & 0b001) << 5) | ((x & 0b001) << 4) |
-	((y & 0b010) << 2) | ((x & 0b010) << 1) |
-	((y & 0b100) >> 1) | ((x & 0b100) >> 2);
+    m = ((y & 0x1) << 5) | ((x & 0x1) << 4) |
+	((y & 0x2) << 2) | ((x & 0x2) << 1) |
+	((y & 0x4) >> 1) | ((x & 0x4) >> 2);
 
     /* m is in range [0, 63].  We scale it to [0, 63.0f/64.0f], then
      * shift it to to [1.0f/128.0f, 127.0f/128.0f] so that 0 < d < 1.
-- 
2.21.0



More information about the Pixman mailing list