From 4c7ed03b5f789c6f898223e595799d413c10f583 Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Thu, 5 Jun 2014 10:14:56 -0500 Subject: [PATCH] COMP: Fix problem with narrowing in c++11 modules/core/src/arithm.cpp:345:51: error: constant expression evaluates to 4294967295 which cannot be narrowed to type 'int' [-Wc++11-narrowing] static int CV_DECL_ALIGNED(16) v64f_absmask[] = { 0xffffffff, 0x7fffffff, 0xffffffff, 0x7fffffff }; ^~~~~~~~~~ Converted to unsigned int. This variable is only used to initialize a bit pattern anywhy for a 128bit type. --- modules/core/src/arithm.cpp | 4 ++-- modules/core/src/ocl.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/core/src/arithm.cpp b/modules/core/src/arithm.cpp index 98d9567..7ca8b4b 100644 --- a/modules/core/src/arithm.cpp +++ b/modules/core/src/arithm.cpp @@ -341,8 +341,8 @@ FUNCTOR_CLOSURE_2arg(VMax, float, return _mm_max_ps(a, b)); FUNCTOR_CLOSURE_2arg(VMax, double, return _mm_max_pd(a, b)); -static int CV_DECL_ALIGNED(16) v32f_absmask[] = { 0x7fffffff, 0x7fffffff, 0x7fffffff, 0x7fffffff }; -static int CV_DECL_ALIGNED(16) v64f_absmask[] = { 0xffffffff, 0x7fffffff, 0xffffffff, 0x7fffffff }; +static unsigned int CV_DECL_ALIGNED(16) v32f_absmask[] = { 0x7fffffff, 0x7fffffff, 0x7fffffff, 0x7fffffff }; +static unsigned int CV_DECL_ALIGNED(16) v64f_absmask[] = { 0xffffffff, 0x7fffffff, 0xffffffff, 0x7fffffff }; FUNCTOR_TEMPLATE(VAbsDiff); FUNCTOR_CLOSURE_2arg(VAbsDiff, uchar, diff --git a/modules/core/src/ocl.cpp b/modules/core/src/ocl.cpp index b580df1..24ca6ee 100644 --- a/modules/core/src/ocl.cpp +++ b/modules/core/src/ocl.cpp @@ -4591,7 +4591,7 @@ struct Image2D::Impl CV_OclDbgAssert(err == CL_SUCCESS); size_t origin[] = { 0, 0, 0 }; - size_t region[] = { src.cols, src.rows, 1 }; + size_t region[] = { static_cast(src.cols), static_cast(src.rows), 1 }; cl_mem devData; if (!alias && !src.isContinuous()) @@ -4599,7 +4599,7 @@ struct Image2D::Impl devData = clCreateBuffer(context, CL_MEM_READ_ONLY, src.cols * src.rows * src.elemSize(), NULL, &err); CV_OclDbgAssert(err == CL_SUCCESS); - const size_t roi[3] = {src.cols * src.elemSize(), src.rows, 1}; + const size_t roi[3] = {static_cast(src.cols) * src.elemSize(), static_cast(src.rows), 1}; CV_Assert(clEnqueueCopyBufferRect(queue, (cl_mem)src.handle(ACCESS_READ), devData, origin, origin, roi, src.step, 0, src.cols * src.elemSize(), 0, 0, NULL, NULL) == CL_SUCCESS); CV_OclDbgAssert(clFlush(queue) == CL_SUCCESS); -- 2.7.4