diff --git a/src/xmlpatterns/api/qcoloroutput_p.h b/src/xmlpatterns/api/qcoloroutput_p.h
index 01614dad94e52045c789d9697c32adba8a5dedda..bd2d5a5a9918bc66d65c5167523128a7ebae1aea 100644
--- a/src/xmlpatterns/api/qcoloroutput_p.h
+++ b/src/xmlpatterns/api/qcoloroutput_p.h
@@ -70,8 +70,8 @@ namespace QPatternist
             ForegroundShift = 10,
             BackgroundShift = 20,
             SpecialShift    = 20,
-            ForegroundMask  = ((1 << ForegroundShift) - 1) << ForegroundShift,
-            BackgroundMask  = ((1 << (sizeof(int) - BackgroundShift)) - 1) << BackgroundShift
+            ForegroundMask  = 0xffc00,
+            BackgroundMask  = 0xfff00000
         };
 
     public: