From 804805d35a87c2acc9425d1762ad26b1ba2ec9ac Mon Sep 17 00:00:00 2001 From: Samuel Barney Date: Wed, 29 Jul 2015 09:04:03 -0600 Subject: Silenced and fixed many warning messages across multiple files. --- src/LinearInterpolation.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/LinearInterpolation.cpp') diff --git a/src/LinearInterpolation.cpp b/src/LinearInterpolation.cpp index 9455f3e4f..c7c690bd2 100644 --- a/src/LinearInterpolation.cpp +++ b/src/LinearInterpolation.cpp @@ -65,14 +65,14 @@ void LinearInterpolate1DArray( a_Dst[0] = a_Src[0]; int DstSizeXm1 = a_DstSizeX - 1; int SrcSizeXm1 = a_SrcSizeX - 1; - float fDstSizeXm1 = (float)DstSizeXm1; - float fSrcSizeXm1 = (float)SrcSizeXm1; + float fDstSizeXm1 = static_cast(DstSizeXm1); + float fSrcSizeXm1 = static_cast(SrcSizeXm1); for (int x = 1; x < DstSizeXm1; x++) { int SrcIdx = x * SrcSizeXm1 / DstSizeXm1; float ValLo = a_Src[SrcIdx]; float ValHi = a_Src[SrcIdx + 1]; - float Ratio = (float)x * fSrcSizeXm1 / fDstSizeXm1 - SrcIdx; + float Ratio = static_cast(x) * fSrcSizeXm1 / fDstSizeXm1 - SrcIdx; a_Dst[x] = ValLo + (ValHi - ValLo) * Ratio; } a_Dst[a_DstSizeX - 1] = a_Src[a_SrcSizeX - 1]; @@ -103,12 +103,12 @@ void LinearInterpolate2DArray( for (int x = 1; x < a_DstSizeX; x++) { SrcIdxX[x] = x * (a_SrcSizeX - 1) / (a_DstSizeX - 1); - RatioX[x] = ((float)(x * (a_SrcSizeX - 1)) / (a_DstSizeX - 1)) - SrcIdxX[x]; + RatioX[x] = (static_cast(x * (a_SrcSizeX - 1)) / (a_DstSizeX - 1)) - SrcIdxX[x]; } for (int y = 1; y < a_DstSizeY; y++) { SrcIdxY[y] = y * (a_SrcSizeY - 1) / (a_DstSizeY - 1); - RatioY[y] = ((float)(y * (a_SrcSizeY - 1)) / (a_DstSizeY - 1)) - SrcIdxY[y]; + RatioY[y] = (static_cast(y * (a_SrcSizeY - 1)) / (a_DstSizeY - 1)) - SrcIdxY[y]; } // Special values at the ends. Notice especially the last indices being (size - 2) with ratio set to 1, to avoid index overflow: @@ -176,17 +176,17 @@ void LinearInterpolate3DArray( for (int x = 1; x < a_DstSizeX; x++) { SrcIdxX[x] = x * (a_SrcSizeX - 1) / (a_DstSizeX - 1); - RatioX[x] = ((float)(x * (a_SrcSizeX - 1)) / (a_DstSizeX - 1)) - SrcIdxX[x]; + RatioX[x] = (static_cast(x * (a_SrcSizeX - 1)) / (a_DstSizeX - 1)) - SrcIdxX[x]; } for (int y = 1; y < a_DstSizeY; y++) { SrcIdxY[y] = y * (a_SrcSizeY - 1) / (a_DstSizeY - 1); - RatioY[y] = ((float)(y * (a_SrcSizeY - 1)) / (a_DstSizeY - 1)) - SrcIdxY[y]; + RatioY[y] = (static_cast(y * (a_SrcSizeY - 1)) / (a_DstSizeY - 1)) - SrcIdxY[y]; } for (int z = 1; z < a_DstSizeZ; z++) { SrcIdxZ[z] = z * (a_SrcSizeZ - 1) / (a_DstSizeZ - 1); - RatioZ[z] = ((float)(z * (a_SrcSizeZ - 1)) / (a_DstSizeZ - 1)) - SrcIdxZ[z]; + RatioZ[z] = (static_cast(z * (a_SrcSizeZ - 1)) / (a_DstSizeZ - 1)) - SrcIdxZ[z]; } // Special values at the ends. Notice especially the last indices being (size - 2) with ratio set to 1, to avoid index overflow: -- cgit v1.2.3