Skip to content

Commit d6992de

Browse files
committed
32 bit
1 parent c5b11d4 commit d6992de

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

‎src/pythonapi/ObjectHolder.cc‎

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ bool ObjectHolder::GetIntegerList(std::vector<int> &values) const
507507
}
508508
}();
509509
#if 0
510-
#if defined(__MINGW32__) || defined(__MINGW64__) || defined(_WIN32) || defined(__ANDROID__)
510+
#if defined(__MINGW32__) || defined(__MINGW64__) || defined(_WIN32)
511511
static_assert(sizeof(long) == sizeof(int), "wrong sizeof(long)");
512512
const std::string search("iIlL");
513513
#elif defined(__linux__) || defined(__APPLE__)
@@ -526,6 +526,21 @@ bool ObjectHolder::GetIntegerList(std::vector<int> &values) const
526526

527527
bool ObjectHolder::GetLongList(std::vector<ptrdiff_t> &values) const
528528
{
529+
static const auto search = []()->auto {
530+
if (sizeof(long) == sizeof(int))
531+
{
532+
return std::string("qQ");
533+
}
534+
else if (sizeof(long) == sizeof(long long))
535+
{
536+
return std::string("lLqQ");
537+
}
538+
else
539+
{
540+
dsAssert(false, "fix int conversion");
541+
}
542+
}();
543+
#if 0
529544
#if defined(__MINGW32__) || defined(__MINGW64__) || defined(_WIN32)
530545
static_assert(sizeof(long) == sizeof(int), "wrong sizeof(long)");
531546
const std::string search("qQ");
@@ -535,6 +550,8 @@ bool ObjectHolder::GetLongList(std::vector<ptrdiff_t> &values) const
535550
#else
536551
#error "FIX TYPE"
537552
#endif
553+
#endif
554+
538555
if (!GetArrayFromBytes<ptrdiff_t>(*this, values, search, sizeof(ptrdiff_t)))
539556
{
540557
return GetFromList<ptrdiff_t>(*this, values);

0 commit comments

Comments
 (0)