Merged in warning_fix (pull request #62)

Converted AtomicString to constexpr char[]

Approved-by: Matt Feemster
This commit is contained in:
Seth 2022-03-14 05:09:46 +00:00 committed by Matt Feemster
commit 24db55010c
2 changed files with 23 additions and 27 deletions

View File

@ -249,30 +249,26 @@ static constexpr char CarToRasFunctionString[] =
"}\n"
"\n";
static string AtomicString()
{
ostringstream os;
os <<
"void AtomicAdd(volatile __global real_bucket_t* source, const real_bucket_t operand)\n"
"{\n"
" union\n"
" {\n"
" atomi intVal;\n"
" real_bucket_t realVal;\n"
" } newVal;\n"
"\n"
" union\n"
" {\n"
" atomi intVal;\n"
" real_bucket_t realVal;\n"
" } prevVal;\n"
"\n"
" do\n"
" {\n"
" prevVal.realVal = *source;\n"
" newVal.realVal = prevVal.realVal + operand;\n"
" } while (atomic_cmpxchg((volatile __global atomi*)source, prevVal.intVal, newVal.intVal) != prevVal.intVal);\n"
"}\n";
return os.str();
}
static constexpr char AtomicString[] =
"void AtomicAdd(volatile __global real_bucket_t* source, const real_bucket_t operand)\n"
"{\n"
" union\n"
" {\n"
" atomi intVal;\n"
" real_bucket_t realVal;\n"
" } newVal;\n"
"\n"
" union\n"
" {\n"
" atomi intVal;\n"
" real_bucket_t realVal;\n"
" } prevVal;\n"
"\n"
" do\n"
" {\n"
" prevVal.realVal = *source;\n"
" newVal.realVal = prevVal.realVal + operand;\n"
" } while (atomic_cmpxchg((volatile __global atomi*)source, prevVal.intVal, newVal.intVal) != prevVal.intVal);\n"
"}\n";
}

View File

@ -334,7 +334,7 @@ string IterOpenCLKernelCreator<T>::CreateIterKernelString(const Ember<T>& ember,
CarToRasFunctionString;
if (lockAccum)
os << AtomicString();
os << AtomicString;
os <<
xformFuncs.str() <<