Skip to content

Commit

Permalink
Fix bug of conversion from long to double
Browse files Browse the repository at this point in the history
It the input is long type, it should be load as long type, not ulong.
  • Loading branch information
wwXing0 committed Nov 15, 2023
1 parent eec46a0 commit a690ce4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test_conformance/conversions/conversions_data_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -385,11 +385,11 @@ void DataInfoSpec<InType, OutType>::conv(OutType *out, InType *in)
if (std::is_same<cl_double, OutType>::value)
{
#if defined(_MSC_VER)
cl_ulong l = ((cl_ulong *)in)[0];
double result;

if (std::is_same<cl_ulong, InType>::value)
{
cl_ulong l = ((cl_ulong *)in)[0];
cl_long sl = ((cl_long)l < 0) ? (cl_long)((l >> 1) | (l & 1))
: (cl_long)l;
#if defined(_M_X64)
Expand All @@ -402,6 +402,7 @@ void DataInfoSpec<InType, OutType>::conv(OutType *out, InType *in)
}
else
{
cl_long l = ((cl_long *)in)[0];
#if defined(_M_X64)
_mm_store_sd(&result, _mm_cvtsi64_sd(_mm_setzero_pd(), l));
#else
Expand Down

0 comments on commit a690ce4

Please sign in to comment.