Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions test_conformance/integer_ops/test_extended_bit_ops_insert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,12 @@ cpu_bit_insert(T tbase, T tinsert, cl_uint offset, cl_uint count)
cl_ulong base = static_cast<cl_ulong>(tbase);
cl_ulong insert = static_cast<cl_ulong>(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<typename std::make_unsigned<T>::type>(result);
}
Expand Down
Loading