diff --git a/test_conformance/integer_ops/test_extended_bit_ops_insert.cpp b/test_conformance/integer_ops/test_extended_bit_ops_insert.cpp index 1fce0255b3..d16c9744eb 100644 --- a/test_conformance/integer_ops/test_extended_bit_ops_insert.cpp +++ b/test_conformance/integer_ops/test_extended_bit_ops_insert.cpp @@ -35,8 +35,12 @@ cpu_bit_insert(T tbase, T tinsert, cl_uint offset, cl_uint count) cl_ulong base = static_cast(tbase); cl_ulong insert = static_cast(tinsert); - cl_ulong mask = (count < 64) ? ((1ULL << count) - 1) << offset : ~0ULL; - cl_ulong result = ((insert << offset) & mask) | (base & ~mask); + cl_ulong result = base; + if (offset < 64) + { + cl_ulong mask = (count < 64) ? ((1ULL << count) - 1) << offset : ~0ULL; + result = ((insert << offset) & mask) | (base & ~mask); + } return static_cast::type>(result); }