diff --git a/src/xmlpatterns/api/qcoloroutput_p.h b/src/xmlpatterns/api/qcoloroutput_p.h
index 864b90d99111d5b258e4627cb6cb67190d870633..01614dad94e52045c789d9697c32adba8a5dedda 100644
--- a/src/xmlpatterns/api/qcoloroutput_p.h
+++ b/src/xmlpatterns/api/qcoloroutput_p.h
@@ -71,7 +71,7 @@ namespace QPatternist
             BackgroundShift = 20,
             SpecialShift    = 20,
             ForegroundMask  = ((1 << ForegroundShift) - 1) << ForegroundShift,
-            BackgroundMask  = ((1 << BackgroundShift) - 1) << BackgroundShift
+            BackgroundMask  = ((1 << (sizeof(int) - BackgroundShift)) - 1) << BackgroundShift
         };
 
     public: