rs: Fix build with ISO C++ 11 compilers
ISO C++ 11 no longer allows implicit narrowing during initialization
Change-Id: Ie359c075b6687962eeaa94d909b6cb92df65213f
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
diff --git a/cpu_ref/rsCpuIntrinsic3DLUT.cpp b/cpu_ref/rsCpuIntrinsic3DLUT.cpp
index 03f24d8..b8d245c 100644
--- a/cpu_ref/rsCpuIntrinsic3DLUT.cpp
+++ b/cpu_ref/rsCpuIntrinsic3DLUT.cpp
@@ -70,10 +70,10 @@
const uchar *bp = (const uchar *)cp->mLUT->mHal.drvState.lod[0].mallocPtr;
int4 dims = {
- cp->mLUT->mHal.drvState.lod[0].dimX - 1,
- cp->mLUT->mHal.drvState.lod[0].dimY - 1,
- cp->mLUT->mHal.drvState.lod[0].dimZ - 1,
- -1
+ static_cast<int>(cp->mLUT->mHal.drvState.lod[0].dimX - 1),
+ static_cast<int>(cp->mLUT->mHal.drvState.lod[0].dimY - 1),
+ static_cast<int>(cp->mLUT->mHal.drvState.lod[0].dimZ - 1),
+ static_cast<int>(-1)
};
const float4 m = (float4)(1.f / 255.f) * convert_float4(dims);
const int4 coordMul = convert_int4(m * (float4)0x8000);
@@ -87,8 +87,8 @@
int32_t len = (x2 - x1 - 1) >> 1;
if(len > 0) {
const short neon_constants[] = {
- coordMul.x, coordMul.y, coordMul.z, 0,
- 0, 0, 0, 0xffff,
+ static_cast<short>(coordMul.x), static_cast<short>(coordMul.y), static_cast<short>(coordMul.z), static_cast<short>(0),
+ 0, 0, 0, static_cast<short>(0xffff),
};
diff --git a/cpu_ref/rsCpuIntrinsicInlines.h b/cpu_ref/rsCpuIntrinsicInlines.h
index d6644ca..71aac7d 100644
--- a/cpu_ref/rsCpuIntrinsicInlines.h
+++ b/cpu_ref/rsCpuIntrinsicInlines.h
@@ -63,7 +63,7 @@
}
static inline int4 convert_int4(float4 i) {
- int4 f4 = {i.x, i.y, i.z, i.w};
+ int4 f4 = {static_cast<int>(i.x), static_cast<int>(i.y), static_cast<int>(i.z), static_cast<int>(i.w)};
return f4;
}
@@ -73,12 +73,12 @@
}
static inline float4 convert_float4(uchar4 i) {
- float4 f4 = {i.x, i.y, i.z, i.w};
+ float4 f4 = {static_cast<float>(i.x), static_cast<float>(i.y), static_cast<float>(i.z), static_cast<float>(i.w)};
return f4;
}
static inline float4 convert_float4(int4 i) {
- float4 f4 = {i.x, i.y, i.z, i.w};
+ float4 f4 = {static_cast<float>(i.x), static_cast<float>(i.y), static_cast<float>(i.z), static_cast<float>(i.w)};
return f4;
}
diff --git a/cpu_ref/rsCpuIntrinsicYuvToRGB.cpp b/cpu_ref/rsCpuIntrinsicYuvToRGB.cpp
index 94fce1c..bec9888 100644
--- a/cpu_ref/rsCpuIntrinsicYuvToRGB.cpp
+++ b/cpu_ref/rsCpuIntrinsicYuvToRGB.cpp
@@ -88,7 +88,7 @@
p.z = 255;
}
- return (uchar4){p.x, p.y, p.z, p.w};
+ return (uchar4){static_cast<uchar>(p.x), static_cast<uchar>(p.y), static_cast<uchar>(p.z), static_cast<uchar>(p.w)};
}