summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Janes <[email protected]>2016-02-01 14:28:00 -0800
committerMark Janes <[email protected]>2016-02-01 14:52:22 -0800
commitac0589b213f21f22dc330d2e8fb8dceda3960ddc (patch)
treeb6b68145bc85879046c479b1c0db1b1abe081ad9
parent8776d3cb8e86d4999613590a7eeac2322acdd99f (diff)
i965: fix unsigned long overflows for i386
bit-shifts on 32 bit unsigned longs overflow in several places. The intention was for 64 bit integers to be used.
-rw-r--r--src/vulkan/gen75_pack.h6
-rw-r--r--src/vulkan/gen7_pack.h6
-rw-r--r--src/vulkan/gen8_pack.h6
-rw-r--r--src/vulkan/gen9_pack.h6
4 files changed, 12 insertions, 12 deletions
diff --git a/src/vulkan/gen75_pack.h b/src/vulkan/gen75_pack.h
index b012032190e..7b098894ee2 100644
--- a/src/vulkan/gen75_pack.h
+++ b/src/vulkan/gen75_pack.h
@@ -47,7 +47,7 @@ union __gen_value {
static inline uint64_t
__gen_mbo(uint32_t start, uint32_t end)
{
- return (~0ul >> (64 - (end - start + 1))) << start;
+ return (~0ull >> (64 - (end - start + 1))) << start;
}
static inline uint64_t
@@ -56,7 +56,7 @@ __gen_field(uint64_t v, uint32_t start, uint32_t end)
__gen_validate_value(v);
#if DEBUG
if (end - start + 1 < 64)
- assert(v < 1ul << (end - start + 1));
+ assert(v < 1ull << (end - start + 1));
#endif
return v << start;
@@ -97,7 +97,7 @@ __gen_offset(uint64_t v, uint32_t start, uint32_t end)
{
__gen_validate_value(v);
#if DEBUG
- uint64_t mask = (~0ul >> (64 - (end - start + 1))) << start;
+ uint64_t mask = (~0ull >> (64 - (end - start + 1))) << start;
assert((v & ~mask) == 0);
#endif
diff --git a/src/vulkan/gen7_pack.h b/src/vulkan/gen7_pack.h
index a3ba30a9745..7b104c3ab3c 100644
--- a/src/vulkan/gen7_pack.h
+++ b/src/vulkan/gen7_pack.h
@@ -47,7 +47,7 @@ union __gen_value {
static inline uint64_t
__gen_mbo(uint32_t start, uint32_t end)
{
- return (~0ul >> (64 - (end - start + 1))) << start;
+ return (~0ull >> (64 - (end - start + 1))) << start;
}
static inline uint64_t
@@ -56,7 +56,7 @@ __gen_field(uint64_t v, uint32_t start, uint32_t end)
__gen_validate_value(v);
#if DEBUG
if (end - start + 1 < 64)
- assert(v < 1ul << (end - start + 1));
+ assert(v < 1ull << (end - start + 1));
#endif
return v << start;
@@ -97,7 +97,7 @@ __gen_offset(uint64_t v, uint32_t start, uint32_t end)
{
__gen_validate_value(v);
#if DEBUG
- uint64_t mask = (~0ul >> (64 - (end - start + 1))) << start;
+ uint64_t mask = (~0ull >> (64 - (end - start + 1))) << start;
assert((v & ~mask) == 0);
#endif
diff --git a/src/vulkan/gen8_pack.h b/src/vulkan/gen8_pack.h
index 042e0290a74..3c014b96147 100644
--- a/src/vulkan/gen8_pack.h
+++ b/src/vulkan/gen8_pack.h
@@ -47,7 +47,7 @@ union __gen_value {
static inline uint64_t
__gen_mbo(uint32_t start, uint32_t end)
{
- return (~0ul >> (64 - (end - start + 1))) << start;
+ return (~0ull >> (64 - (end - start + 1))) << start;
}
static inline uint64_t
@@ -56,7 +56,7 @@ __gen_field(uint64_t v, uint32_t start, uint32_t end)
__gen_validate_value(v);
#if DEBUG
if (end - start + 1 < 64)
- assert(v < 1ul << (end - start + 1));
+ assert(v < 1ull << (end - start + 1));
#endif
return v << start;
@@ -97,7 +97,7 @@ __gen_offset(uint64_t v, uint32_t start, uint32_t end)
{
__gen_validate_value(v);
#if DEBUG
- uint64_t mask = (~0ul >> (64 - (end - start + 1))) << start;
+ uint64_t mask = (~0ull >> (64 - (end - start + 1))) << start;
assert((v & ~mask) == 0);
#endif
diff --git a/src/vulkan/gen9_pack.h b/src/vulkan/gen9_pack.h
index db54e9cf85b..df295f4900a 100644
--- a/src/vulkan/gen9_pack.h
+++ b/src/vulkan/gen9_pack.h
@@ -47,7 +47,7 @@ union __gen_value {
static inline uint64_t
__gen_mbo(uint32_t start, uint32_t end)
{
- return (~0ul >> (64 - (end - start + 1))) << start;
+ return (~0ull >> (64 - (end - start + 1))) << start;
}
static inline uint64_t
@@ -56,7 +56,7 @@ __gen_field(uint64_t v, uint32_t start, uint32_t end)
__gen_validate_value(v);
#if DEBUG
if (end - start + 1 < 64)
- assert(v < 1ul << (end - start + 1));
+ assert(v < 1ull << (end - start + 1));
#endif
return v << start;
@@ -97,7 +97,7 @@ __gen_offset(uint64_t v, uint32_t start, uint32_t end)
{
__gen_validate_value(v);
#if DEBUG
- uint64_t mask = (~0ul >> (64 - (end - start + 1))) << start;
+ uint64_t mask = (~0ull >> (64 - (end - start + 1))) << start;
assert((v & ~mask) == 0);
#endif