Skip to content

Commit 79dd04b

Browse files
Mapping from typenum to standard types updated with 'long long'
The example if gh-1167 creates a numpy array with dtype equal to unsigned long-long (typenum 10). dpctl's mapping from typenums to factual C++ types did not include long long and its unsigned variant.
1 parent 8f2ba46 commit 79dd04b

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

dpctl/tensor/libtensor/include/utils/type_dispatch.hpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,17 @@ struct usm_ndarray_types
223223
throw_unrecognized_typenum_error(typenum);
224224
}
225225
}
226+
else if (typenum == api.UAR_LONGLONG_ || typenum == api.UAR_ULONGLONG_)
227+
{
228+
switch (sizeof(long long)) {
229+
case sizeof(std::int64_t):
230+
return ((typenum == api.UAR_LONGLONG_)
231+
? static_cast<int>(typenum_t::INT64)
232+
: static_cast<int>(typenum_t::UINT64));
233+
default:
234+
throw_unrecognized_typenum_error(typenum);
235+
}
236+
}
226237
else {
227238
throw_unrecognized_typenum_error(typenum);
228239
}
@@ -234,7 +245,7 @@ struct usm_ndarray_types
234245
private:
235246
void throw_unrecognized_typenum_error(int typenum) const
236247
{
237-
throw std::runtime_error("Unrecogized typenum " +
248+
throw std::runtime_error("Unrecognized typenum " +
238249
std::to_string(typenum) + " encountered.");
239250
}
240251
};

0 commit comments

Comments
 (0)