Skip to content

Commit 0105518

Browse files
committed
Merge pull request opencv#10190 from seiko2plus:issue10189
2 parents e703c30 + 6fe6436 commit 0105518

File tree

3 files changed

+36
-5
lines changed

3 files changed

+36
-5
lines changed

modules/core/include/opencv2/core/hal/intrin_vsx.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,11 @@ inline _Tpvec v_rotate_right(const _Tpvec& a, const _Tpvec& b)
638638
enum { CV_SHIFT = 16 - imm * (sizeof(typename _Tpvec::lane_type)) };
639639
if (CV_SHIFT == 16)
640640
return a;
641+
#ifdef __IBMCPP__
642+
return _Tpvec(vec_sld(b.val, a.val, CV_SHIFT & 15));
643+
#else
641644
return _Tpvec(vec_sld(b.val, a.val, CV_SHIFT));
645+
#endif
642646
}
643647

644648
template<int imm, typename _Tpvec>

modules/core/include/opencv2/core/vsx_utils.hpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,21 @@ FORCE_INLINE(rt) fnm(const rg& a) { return __builtin_convertvector(a, rt); }
420420
{ return vec_div(vec_double2_sp(1), vec_sqrt(a)); }
421421
#endif
422422

423+
// vec_promote missing support for doubleword
424+
FORCE_INLINE(vec_dword2) vec_promote(long long a, int b)
425+
{
426+
vec_dword2 ret = vec_dword2_z;
427+
ret[b & 1] = a;
428+
return ret;
429+
}
430+
431+
FORCE_INLINE(vec_udword2) vec_promote(unsigned long long a, int b)
432+
{
433+
vec_udword2 ret = vec_udword2_z;
434+
ret[b & 1] = a;
435+
return ret;
436+
}
437+
423438
// vec_popcnt should return unsigned but clang has different thought just like gcc in vec_vpopcnt
424439
#define VSX_IMPL_POPCNTU(Tvec, Tvec2, ucast) \
425440
FORCE_INLINE(Tvec) vec_popcntu(const Tvec2& a) \
@@ -569,6 +584,12 @@ VSX_IMPL_DIRTY_ODD(vec_udword2, vec_float4, vec_ctulo, vec_ctul)
569584

570585
FORCE_INLINE(vec_dword2) vec_splats(int64 v)
571586
{ return vec_splats((long long) v); }
587+
588+
FORCE_INLINE(vec_udword2) vec_promote(uint64 a, int b)
589+
{ return vec_promote((unsigned long long) a, b); }
590+
591+
FORCE_INLINE(vec_dword2) vec_promote(int64 a, int b)
592+
{ return vec_promote((long long) a, b); }
572593
#endif
573594

574595
/*

modules/core/test/test_ptr.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@
4141

4242
#include "test_precomp.hpp"
4343

44+
#ifdef GTEST_CAN_COMPARE_NULL
45+
# define EXPECT_NULL(ptr) EXPECT_EQ(NULL, ptr)
46+
#else
47+
# define EXPECT_NULL(ptr) EXPECT_TRUE(ptr == NULL)
48+
#endif
49+
4450
using namespace cv;
4551

4652
namespace {
@@ -78,7 +84,7 @@ int dummyObject;
7884
TEST(Core_Ptr, default_ctor)
7985
{
8086
Ptr<int> p;
81-
EXPECT_EQ(NULL, p.get());
87+
EXPECT_NULL(p.get());
8288
}
8389

8490
TEST(Core_Ptr, owning_ctor)
@@ -102,7 +108,7 @@ TEST(Core_Ptr, owning_ctor)
102108

103109
{
104110
Ptr<void> p((void*)0, ReportingDeleter(&deleted));
105-
EXPECT_EQ(NULL, p.get());
111+
EXPECT_NULL(p.get());
106112
}
107113

108114
EXPECT_FALSE(deleted);
@@ -187,7 +193,7 @@ TEST(Core_Ptr, release)
187193
Ptr<Reporter> p1(new Reporter(&deleted));
188194
p1.release();
189195
EXPECT_TRUE(deleted);
190-
EXPECT_EQ(NULL, p1.get());
196+
EXPECT_NULL(p1.get());
191197
}
192198

193199
TEST(Core_Ptr, reset)
@@ -253,7 +259,7 @@ TEST(Core_Ptr, accessors)
253259
{
254260
{
255261
Ptr<int> p;
256-
EXPECT_EQ(NULL, static_cast<int*>(p));
262+
EXPECT_NULL(static_cast<int*>(p));
257263
EXPECT_TRUE(p.empty());
258264
}
259265

@@ -327,7 +333,7 @@ TEST(Core_Ptr, casts)
327333
{
328334
Ptr<Reporter> p1(new Reporter(&deleted));
329335
Ptr<SubReporter> p2 = p1.dynamicCast<SubReporter>();
330-
EXPECT_EQ(NULL, p2.get());
336+
EXPECT_NULL(p2.get());
331337
p1.release();
332338
EXPECT_FALSE(deleted);
333339
}

0 commit comments

Comments
 (0)