Skip to content

Commit

Permalink
Fix GDL Convert() internal function for compatibility with ARM64 (#1949)
Browse files Browse the repository at this point in the history
  • Loading branch information
GillesDuvert authored Dec 15, 2024
1 parent e0d4cd7 commit 2990fa2
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 803 deletions.
147 changes: 90 additions & 57 deletions src/convert2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@ using namespace std;
if( nEl == 1) { (*dest)[0]=(*this)[0]; if( (mode & BaseGDL::CONVERT) != 0) delete this; return dest;}\
if((GDL_NTHREADS=parallelize(nEl, TP_ARRAY_INITIALISATION))==1) {for( SizeT i=0; i < nEl; ++i) (*dest)[i]=(*this)[i]; if( (mode & BaseGDL::CONVERT) != 0) delete this; return dest; }

#define DO_CONVERT_START_FLOAT_TO_UNSIGNED_IA64(tnew, unsigned, signed) DO_CONVERT_START(tnew)

#define DO_CONVERT_START_FLOAT_TO_UNSIGNED_ARM64(tnew, unsigned, signed) {\
Data_<tnew>* dest=new Data_<tnew>( dim, BaseGDL::NOZERO);\
if( nEl == 1) { (*dest)[0]=static_cast<unsigned>(static_cast<signed>((*this)[0])); if( (mode & BaseGDL::CONVERT) != 0) delete this; return dest;}\
if((GDL_NTHREADS=parallelize(nEl, TP_ARRAY_INITIALISATION))==1) {for( SizeT i=0; i < nEl; ++i) (*dest)[i]=static_cast<unsigned>(static_cast<signed>((*this)[i])); if( (mode & BaseGDL::CONVERT) != 0) delete this; return dest; }

#ifdef __aarch64__
#define DO_CONVERT_START_FLOAT_TO_UNSIGNED(tnew, unsigned, signed) DO_CONVERT_START_FLOAT_TO_UNSIGNED_ARM64(tnew, unsigned, signed)
#else
#define DO_CONVERT_START_FLOAT_TO_UNSIGNED(tnew, unsigned, signed) DO_CONVERT_START_FLOAT_TO_UNSIGNED_IA64(tnew, unsigned, signed)
#endif

#define DO_CONVERT_START_BIG_TO_SMALL(tnew, mask) {\
Data_<tnew>* dest=new Data_<tnew>( dim, BaseGDL::NOZERO);\
if( nEl == 1) { (*dest)[0]=((*this)[0]&mask); if( (mode & BaseGDL::CONVERT) != 0) delete this; return dest;}\
Expand All @@ -44,6 +57,18 @@ using namespace std;
if( nEl == 1) { (*dest)[0]=(*this)[0].real(); if( (mode & BaseGDL::CONVERT) != 0) delete this; return dest;}\
if((GDL_NTHREADS=parallelize(nEl, TP_ARRAY_INITIALISATION))==1) {for( SizeT i=0; i < nEl; ++i) (*dest)[i]=(*this)[i].real(); if( (mode & BaseGDL::CONVERT) != 0) delete this; return dest; }

#define DO_CONVERT_START_FLOAT_TO_UNSIGNED_CPX_IA64(tnew, unsigned, signed) DO_CONVERT_START_CPX(tnew)

#define DO_CONVERT_START_FLOAT_TO_UNSIGNED_CPX_ARM64(tnew, unsigned, signed) {\
Data_<tnew>* dest=new Data_<tnew>( dim, BaseGDL::NOZERO);\
if( nEl == 1) { (*dest)[0]=static_cast<unsigned>(static_cast<signed>((*this)[0].real())); if( (mode & BaseGDL::CONVERT) != 0) delete this; return dest;}\
if((GDL_NTHREADS=parallelize(nEl, TP_ARRAY_INITIALISATION))==1) {for( SizeT i=0; i < nEl; ++i) (*dest)[i]=static_cast<unsigned>(static_cast<signed>((*this)[i].real())); if( (mode & BaseGDL::CONVERT) != 0) delete this; return dest; }
#ifdef __aarch64__
#define DO_CONVERT_START_FLOAT_TO_UNSIGNED_CPX(tnew, unsigned, signed) DO_CONVERT_START_FLOAT_TO_UNSIGNED_CPX_ARM64(tnew, unsigned, signed)
#else
#define DO_CONVERT_START_FLOAT_TO_UNSIGNED_CPX(tnew, unsigned, signed) DO_CONVERT_START_FLOAT_TO_UNSIGNED_CPX_IA64(tnew, unsigned, signed)
#endif

#define DO_CONVERT_END for( SizeT i=0; i < nEl; ++i) (*dest)[i]=(*this)[i]; if( (mode & BaseGDL::CONVERT) != 0) delete this; return dest; }
#define DO_CONVERT_END_BIG_TO_SMALL(mask) for( SizeT i=0; i < nEl; ++i) (*dest)[i]=((*this)[i]&mask); if( (mode & BaseGDL::CONVERT) != 0) delete this; return dest; }
#define DO_CONVERT_END_CPX for( SizeT i=0; i < nEl; ++i) (*dest)[i]=(*this)[i].real(); if( (mode & BaseGDL::CONVERT) != 0) delete this; return dest; }
Expand Down Expand Up @@ -242,15 +267,17 @@ template<> BaseGDL* Data_<SpDByte>::Convert2(DType destTy, BaseGDL::Convert2Mode
DO_CONVERT_END
case GDL_STRING: // GDL_BYTE to GDL_STRING: remove first dim
{ if (mode == BaseGDL::COPY_BYTE_AS_INT) {
Data_<SpDString>* dest = new Data_<SpDString>(dim, BaseGDL::NOZERO);
Data_<SpDString>* dest = new Data_<SpDString>(dim, BaseGDL::NOZERO, 4);
if ((GDL_NTHREADS = parallelize(nEl, TP_ARRAY_INITIALISATION)) == 1) {
for (SizeT i = 0; i < nEl; ++i) (*dest)[i] = i2s(static_cast<int> ((*this)[i]), 4);
} else {
TRACEOMP(__FILE__, __LINE__)
#pragma omp parallel for num_threads(GDL_NTHREADS)
for (SizeT i = 0; i < nEl; ++i)
(*dest)[i] = i2s(static_cast<int> ((*this)[i]), 4);
for (SizeT i = 0; i < nEl; ++i) (*dest)[i] = i2s(static_cast<int> ((*this)[i]), 4);
}
if ((mode & BaseGDL::CONVERT) != 0) delete this;
return dest;
} else //NOTE: This should be only for BYTES according to the doc, but IDL in fact does it for all integer types below l64 apparently
{
} else { //NOTE: This should be only for BYTES according to the doc, but IDL in fact does it for all integer types below l64 apparently
dimension strDim(dim);
SizeT strLen = strDim.Remove(0);

Expand All @@ -269,12 +296,11 @@ template<> BaseGDL* Data_<SpDByte>::Convert2(DType destTy, BaseGDL::Convert2Mode
for (SizeT b = 0; b < strLen; b++)
buf[b] = (*this)[ basePtr + b];

(*dest)[i] = buf; //i2s((*this)[i]);
}

if ((mode & BaseGDL::CONVERT) != 0) delete this;
return dest;
}
(*dest)[i] = buf;
}
if ((mode & BaseGDL::CONVERT) != 0) delete this;
return dest;
}
}
case GDL_PTR:
case GDL_OBJ:
Expand Down Expand Up @@ -349,15 +375,13 @@ template<> BaseGDL* Data_<SpDInt>::Convert2(DType destTy, BaseGDL::Convert2Mode
case GDL_STRING:
{
char buf[32];
Data_<SpDString>* dest = new Data_<SpDString>(dim, BaseGDL::NOZERO, 12);
Data_<SpDString>* dest = new Data_<SpDString>(dim, BaseGDL::NOZERO, 8);
if ((GDL_NTHREADS = parallelize(nEl, TP_ARRAY_INITIALISATION)) == 1) {
for (SizeT i = 0; i < nEl; ++i) {
snprintf(buf,32, "%8i", (*this)[i]);
(*dest)[i] = std::string(buf);
// (*dest)[i] = i2s((*this)[i], 8);
}
if ((mode & BaseGDL::CONVERT) != 0) delete this;
return dest;
} else {
TRACEOMP(__FILE__, __LINE__)
#pragma omp parallel for num_threads(GDL_NTHREADS)
Expand All @@ -366,9 +390,9 @@ template<> BaseGDL* Data_<SpDInt>::Convert2(DType destTy, BaseGDL::Convert2Mode
(*dest)[i] = std::string(buf);
// (*dest)[i] = i2s((*this)[i], 8);
}
if ((mode & BaseGDL::CONVERT) != 0) delete this;
return dest;
}
}
if ((mode & BaseGDL::CONVERT) != 0) delete this;
return dest;
}
case GDL_PTR:
case GDL_OBJ:
Expand Down Expand Up @@ -443,26 +467,24 @@ template<> BaseGDL* Data_<SpDUInt>::Convert2(DType destTy, BaseGDL::Convert2Mode
case GDL_STRING: // GDL_BYTE to GDL_STRING: remove first dim
{
char buf[32];
Data_<SpDString>* dest = new Data_<SpDString>(dim, BaseGDL::NOZERO, 12);
Data_<SpDString>* dest = new Data_<SpDString>(dim, BaseGDL::NOZERO, 8);
if ((GDL_NTHREADS = parallelize(nEl, TP_ARRAY_INITIALISATION)) == 1) {
for (SizeT i = 0; i < nEl; ++i) {
snprintf(buf,32, "%8i", (*this)[i]);
snprintf(buf,32, "%8u", (*this)[i]);
(*dest)[i] = std::string(buf);
// (*dest)[i] = i2s((*this)[i], 8);
}
if ((mode & BaseGDL::CONVERT) != 0) delete this;
return dest;
} else {
TRACEOMP(__FILE__, __LINE__)
#pragma omp parallel for num_threads(GDL_NTHREADS)
for (SizeT i = 0; i < nEl; ++i) {
snprintf(buf,32, "%8i", (*this)[i]);
snprintf(buf,32, "%8u", (*this)[i]);
(*dest)[i] = std::string(buf);
// (*dest)[i] = i2s((*this)[i], 8);
}
if ((mode & BaseGDL::CONVERT) != 0) delete this;
return dest;
}
}
if ((mode & BaseGDL::CONVERT) != 0) delete this;
return dest;
}

case GDL_PTR:
Expand Down Expand Up @@ -545,8 +567,6 @@ template<> BaseGDL* Data_<SpDLong>::Convert2(DType destTy, BaseGDL::Convert2Mode
(*dest)[i] = std::string(buf);
// (*dest)[i] = i2s((*this)[i], 12);
}
if ((mode & BaseGDL::CONVERT) != 0) delete this;
return dest;
} else {
TRACEOMP(__FILE__, __LINE__)
#pragma omp parallel for num_threads(GDL_NTHREADS)
Expand All @@ -555,9 +575,9 @@ template<> BaseGDL* Data_<SpDLong>::Convert2(DType destTy, BaseGDL::Convert2Mode
(*dest)[i] = std::string(buf);
// (*dest)[i] = i2s((*this)[i], 12);
}
if ((mode & BaseGDL::CONVERT) != 0) delete this;
return dest;
}
}
if ((mode & BaseGDL::CONVERT) != 0) delete this;
return dest;
}
case GDL_PTR:
case GDL_OBJ:
Expand Down Expand Up @@ -636,24 +656,22 @@ template<> BaseGDL* Data_<SpDULong>::Convert2(DType destTy, BaseGDL::Convert2Mod
Data_<SpDString>* dest = new Data_<SpDString>(dim, BaseGDL::NOZERO, 12);
if ((GDL_NTHREADS = parallelize(nEl, TP_ARRAY_INITIALISATION)) == 1) {
for (SizeT i = 0; i < nEl; ++i) {
snprintf(buf,32, "%12i", (*this)[i]);
snprintf(buf,32, "%12u", (*this)[i]);
(*dest)[i] = std::string(buf);
// (*dest)[i] = i2s((*this)[i], 12);
}
if ((mode & BaseGDL::CONVERT) != 0) delete this;
return dest;
} else {
TRACEOMP(__FILE__, __LINE__)
#pragma omp parallel for num_threads(GDL_NTHREADS)
for (SizeT i = 0; i < nEl; ++i) {
snprintf(buf,32, "%12i", (*this)[i]);
snprintf(buf,32, "%12u", (*this)[i]);
(*dest)[i] = std::string(buf);
// (*dest)[i] = i2s((*this)[i], 12);
}
if ((mode & BaseGDL::CONVERT) != 0) delete this;
return dest;
}
}
}
if ((mode & BaseGDL::CONVERT) != 0) delete this;
return dest;
}
case GDL_PTR:
case GDL_OBJ:
case GDL_STRUCT:
Expand Down Expand Up @@ -685,7 +703,7 @@ template<> BaseGDL* Data_<SpDFloat>::Convert2(DType destTy, BaseGDL::Convert2Mod
#pragma omp parallel for num_threads(GDL_NTHREADS)
DO_CONVERT_END
case GDL_UINT:
DO_CONVERT_START(SpDUInt)
DO_CONVERT_START_FLOAT_TO_UNSIGNED(SpDUInt, DUInt, DInt)
TRACEOMP(__FILE__, __LINE__)
#pragma omp parallel for num_threads(GDL_NTHREADS)
DO_CONVERT_END
Expand All @@ -695,7 +713,7 @@ template<> BaseGDL* Data_<SpDFloat>::Convert2(DType destTy, BaseGDL::Convert2Mod
#pragma omp parallel for num_threads(GDL_NTHREADS)
DO_CONVERT_END
case GDL_ULONG:
DO_CONVERT_START(SpDULong)
DO_CONVERT_START_FLOAT_TO_UNSIGNED(SpDULong, DULong, DLong)
TRACEOMP(__FILE__, __LINE__)
#pragma omp parallel for num_threads(GDL_NTHREADS)
DO_CONVERT_END
Expand All @@ -705,7 +723,7 @@ template<> BaseGDL* Data_<SpDFloat>::Convert2(DType destTy, BaseGDL::Convert2Mod
#pragma omp parallel for num_threads(GDL_NTHREADS)
DO_CONVERT_END
case GDL_ULONG64:
DO_CONVERT_START(SpDULong64)
DO_CONVERT_START_FLOAT_TO_UNSIGNED(SpDULong64, DULong64, DLong64)
TRACEOMP(__FILE__, __LINE__)
#pragma omp parallel for num_threads(GDL_NTHREADS)
DO_CONVERT_END
Expand All @@ -726,12 +744,16 @@ template<> BaseGDL* Data_<SpDFloat>::Convert2(DType destTy, BaseGDL::Convert2Mod
TRACEOMP(__FILE__, __LINE__)
#pragma omp parallel for num_threads(GDL_NTHREADS)
DO_CONVERT_END
case GDL_STRING: // GDL_BYTE to GDL_STRING: remove first dim
case GDL_STRING:
{
Data_<SpDString>* dest = new Data_<SpDString>(dim, BaseGDL::NOZERO);
TRACEOMP(__FILE__, __LINE__)
if ((GDL_NTHREADS = parallelize(nEl, TP_ARRAY_INITIALISATION)) == 1) {
for (SizeT i = 0; i < nEl; ++i) (*dest)[i] = float2string((*this)[i]);
} else {
TRACEOMP(__FILE__, __LINE__)
#pragma omp parallel for num_threads(GDL_NTHREADS)
for (SizeT i = 0; i < nEl; ++i) (*dest)[i] = float2string((*this)[i]);
}
if ((mode & BaseGDL::CONVERT) != 0) delete this;
return dest;
}
Expand Down Expand Up @@ -767,7 +789,7 @@ template<> BaseGDL* Data_<SpDDouble>::Convert2(DType destTy, BaseGDL::Convert2Mo
#pragma omp parallel for num_threads(GDL_NTHREADS)
DO_CONVERT_END
case GDL_UINT:
DO_CONVERT_START(SpDUInt)
DO_CONVERT_START_FLOAT_TO_UNSIGNED(SpDUInt, DUInt, DInt)
TRACEOMP(__FILE__, __LINE__)
#pragma omp parallel for num_threads(GDL_NTHREADS)
DO_CONVERT_END
Expand All @@ -777,7 +799,7 @@ template<> BaseGDL* Data_<SpDDouble>::Convert2(DType destTy, BaseGDL::Convert2Mo
#pragma omp parallel for num_threads(GDL_NTHREADS)
DO_CONVERT_END
case GDL_ULONG:
DO_CONVERT_START(SpDULong)
DO_CONVERT_START_FLOAT_TO_UNSIGNED(SpDULong, DULong, DLong)
TRACEOMP(__FILE__, __LINE__)
#pragma omp parallel for num_threads(GDL_NTHREADS)
DO_CONVERT_END
Expand All @@ -787,7 +809,7 @@ template<> BaseGDL* Data_<SpDDouble>::Convert2(DType destTy, BaseGDL::Convert2Mo
#pragma omp parallel for num_threads(GDL_NTHREADS)
DO_CONVERT_END
case GDL_ULONG64:
DO_CONVERT_START(SpDULong64)
DO_CONVERT_START_FLOAT_TO_UNSIGNED(SpDULong64, DULong64, DLong64)
TRACEOMP(__FILE__, __LINE__)
#pragma omp parallel for num_threads(GDL_NTHREADS)
DO_CONVERT_END
Expand All @@ -810,9 +832,13 @@ template<> BaseGDL* Data_<SpDDouble>::Convert2(DType destTy, BaseGDL::Convert2Mo
case GDL_STRING: // GDL_BYTE to GDL_STRING: remove first dim
{
Data_<SpDString>* dest = new Data_<SpDString>(dim, BaseGDL::NOZERO);
if ((GDL_NTHREADS = parallelize(nEl, TP_ARRAY_INITIALISATION)) == 1) {
for (SizeT i = 0; i < nEl; ++i) (*dest)[i] = double2string((*this)[i]);
} else {
TRACEOMP(__FILE__, __LINE__)
#pragma omp parallel for num_threads(GDL_NTHREADS)
for (SizeT i = 0; i < nEl; ++i) (*dest)[i] = double2string((*this)[i]);
}
if ((mode & BaseGDL::CONVERT) != 0) delete this;
return dest;
}
Expand Down Expand Up @@ -1150,7 +1176,7 @@ template<> BaseGDL* Data_<SpDComplex>::Convert2(DType destTy, BaseGDL::Convert2M
#pragma omp parallel for num_threads(GDL_NTHREADS)
DO_CONVERT_END_CPX
case GDL_UINT:
DO_CONVERT_START_CPX(SpDUInt)
DO_CONVERT_START_FLOAT_TO_UNSIGNED_CPX(SpDUInt, DUInt, DInt)
TRACEOMP(__FILE__, __LINE__)
#pragma omp parallel for num_threads(GDL_NTHREADS)
DO_CONVERT_END_CPX
Expand All @@ -1160,7 +1186,7 @@ template<> BaseGDL* Data_<SpDComplex>::Convert2(DType destTy, BaseGDL::Convert2M
#pragma omp parallel for num_threads(GDL_NTHREADS)
DO_CONVERT_END_CPX
case GDL_ULONG:
DO_CONVERT_START_CPX(SpDULong)
DO_CONVERT_START_FLOAT_TO_UNSIGNED_CPX(SpDULong, DULong, DLong)
TRACEOMP(__FILE__, __LINE__)
#pragma omp parallel for num_threads(GDL_NTHREADS)
DO_CONVERT_END_CPX
Expand All @@ -1170,7 +1196,7 @@ template<> BaseGDL* Data_<SpDComplex>::Convert2(DType destTy, BaseGDL::Convert2M
#pragma omp parallel for num_threads(GDL_NTHREADS)
DO_CONVERT_END_CPX
case GDL_ULONG64:
DO_CONVERT_START_CPX(SpDULong64)
DO_CONVERT_START_FLOAT_TO_UNSIGNED_CPX(SpDULong64, DULong64, DLong64)
TRACEOMP(__FILE__, __LINE__)
#pragma omp parallel for num_threads(GDL_NTHREADS)
DO_CONVERT_END_CPX
Expand Down Expand Up @@ -1212,7 +1238,10 @@ template<> BaseGDL* Data_<SpDComplex>::Convert2(DType destTy, BaseGDL::Convert2M
case GDL_STRING: // GDL_BYTE to GDL_STRING: remove first dim
{
Data_<SpDString>* dest = new Data_<SpDString>(dim, BaseGDL::NOZERO);
TRACEOMP(__FILE__, __LINE__)
if ((GDL_NTHREADS = parallelize(nEl, TP_ARRAY_INITIALISATION)) == 1) {
for (SizeT i = 0; i < nEl; ++i) (*dest)[i] = complex2string((*this)[i]);
} else {
TRACEOMP(__FILE__, __LINE__)
#pragma omp parallel for num_threads(GDL_NTHREADS)
// JW
// for (SizeT i = 0; i < nEl; ++i) (*dest)[i] = "(" + float2string(real((*this)[i])) + "," + float2string(imag((*this)[i])) + ")";
Expand All @@ -1224,7 +1253,7 @@ template<> BaseGDL* Data_<SpDComplex>::Convert2(DType destTy, BaseGDL::Convert2M
(*dest)[i].resize(32);
snprintf(&((*dest)[i])[0],32,"(%#13.6g,%#13.6g)",(*this)[i].real(),(*this)[i].imag());
} */

}
if ((mode & BaseGDL::CONVERT) != 0) delete this;
return dest;
}//JW, Feb 2022
Expand Down Expand Up @@ -1259,7 +1288,7 @@ template<> BaseGDL* Data_<SpDComplexDbl>::Convert2(DType destTy, BaseGDL::Conver
#pragma omp parallel for num_threads(GDL_NTHREADS)
DO_CONVERT_END_CPX
case GDL_UINT:
DO_CONVERT_START_CPX(SpDUInt)
DO_CONVERT_START_FLOAT_TO_UNSIGNED_CPX(SpDUInt, DUInt, DInt)
TRACEOMP(__FILE__, __LINE__)
#pragma omp parallel for num_threads(GDL_NTHREADS)
DO_CONVERT_END_CPX
Expand All @@ -1269,7 +1298,7 @@ template<> BaseGDL* Data_<SpDComplexDbl>::Convert2(DType destTy, BaseGDL::Conver
#pragma omp parallel for num_threads(GDL_NTHREADS)
DO_CONVERT_END_CPX
case GDL_ULONG:
DO_CONVERT_START_CPX(SpDULong)
DO_CONVERT_START_FLOAT_TO_UNSIGNED_CPX(SpDULong, DULong, DLong)
TRACEOMP(__FILE__, __LINE__)
#pragma omp parallel for num_threads(GDL_NTHREADS)
DO_CONVERT_END_CPX
Expand All @@ -1279,7 +1308,7 @@ template<> BaseGDL* Data_<SpDComplexDbl>::Convert2(DType destTy, BaseGDL::Conver
#pragma omp parallel for num_threads(GDL_NTHREADS)
DO_CONVERT_END_CPX
case GDL_ULONG64:
DO_CONVERT_START_CPX(SpDULong64)
DO_CONVERT_START_FLOAT_TO_UNSIGNED_CPX(SpDULong64, DULong64, DLong64)
TRACEOMP(__FILE__, __LINE__)
#pragma omp parallel for num_threads(GDL_NTHREADS)
DO_CONVERT_END_CPX
Expand Down Expand Up @@ -1313,12 +1342,16 @@ template<> BaseGDL* Data_<SpDComplexDbl>::Convert2(DType destTy, BaseGDL::Conver
case GDL_STRING: // GDL_BYTE to GDL_STRING: remove first dim
{
Data_<SpDString>* dest = new Data_<SpDString>(dim, BaseGDL::NOZERO);
TRACEOMP(__FILE__, __LINE__)
if ((GDL_NTHREADS = parallelize(nEl, TP_ARRAY_INITIALISATION)) == 1) {
for (SizeT i = 0; i < nEl; ++i) (*dest)[i] = dcomplex2string((*this)[i]);
} else {
TRACEOMP(__FILE__, __LINE__)
#pragma omp parallel for num_threads(GDL_NTHREADS)
//JW for (SizeT i = 0; i < nEl; ++i) (*dest)[i] = "(" + double2string(real((*this)[i])) + "," + double2string(imag((*this)[i])) + ")";

//AC
for (SizeT i = 0; i < nEl; ++i) (*dest)[i] = dcomplex2string((*this)[i]);
}
if ((mode & BaseGDL::CONVERT) != 0) delete this;
return dest;
} //JW, Feb 2022
Expand Down Expand Up @@ -1401,7 +1434,7 @@ template<> BaseGDL* Data_<SpDLong64>::Convert2(DType destTy, BaseGDL::Convert2Mo
case GDL_STRING: // GDL_BYTE to GDL_STRING: remove first dim
{
char buf[32];
Data_<SpDString>* dest = new Data_<SpDString>(dim, BaseGDL::NOZERO, 12);
Data_<SpDString>* dest = new Data_<SpDString>(dim, BaseGDL::NOZERO, 22);
if ((GDL_NTHREADS = parallelize(nEl, TP_ARRAY_INITIALISATION)) == 1) {
for (SizeT i = 0; i < nEl; ++i) {
snprintf(buf,32, "%22lli", (*this)[i]);
Expand Down Expand Up @@ -1497,7 +1530,7 @@ template<> BaseGDL* Data_<SpDULong64>::Convert2(DType destTy, BaseGDL::Convert2M
case GDL_STRING: // GDL_BYTE to GDL_STRING: remove first dim
{
char buf[32];
Data_<SpDString>* dest = new Data_<SpDString>(dim, BaseGDL::NOZERO, 12);
Data_<SpDString>* dest = new Data_<SpDString>(dim, BaseGDL::NOZERO, 22);
if ((GDL_NTHREADS = parallelize(nEl, TP_ARRAY_INITIALISATION)) == 1) {
for (SizeT i = 0; i < nEl; ++i) {
snprintf(buf,32, "%22llu", (*this)[i]);
Expand Down
Loading

0 comments on commit 2990fa2

Please sign in to comment.