From 7579a9ec37ba476b0379af227b4c704d966e8158 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 4 Nov 2012 10:20:16 +0000 Subject: code cleanup: double promotions --- intern/audaspace/FX/AUD_ButterworthFactory.cpp | 10 +++++----- intern/audaspace/FX/AUD_DelayReader.cpp | 4 ++-- intern/audaspace/FX/AUD_HighpassFactory.cpp | 4 ++-- intern/bsp/intern/BOP_CarveInterface.cpp | 2 +- .../compositor/operations/COM_GlareFogGlowOperation.cpp | 6 +++--- source/blender/editors/space_file/filelist.c | 2 +- source/blender/imbuf/intern/cineon/logImageCore.c | 2 +- source/blender/imbuf/intern/radiance_hdr.c | 2 +- source/blender/render/intern/raytrace/svbvh.h | 2 +- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/intern/audaspace/FX/AUD_ButterworthFactory.cpp b/intern/audaspace/FX/AUD_ButterworthFactory.cpp index 5edca302ece..af1a5af97df 100644 --- a/intern/audaspace/FX/AUD_ButterworthFactory.cpp +++ b/intern/audaspace/FX/AUD_ButterworthFactory.cpp @@ -53,11 +53,11 @@ void AUD_ButterworthFactory::recalculateCoefficients(AUD_SampleRate rate, float omega = 2 * tan(m_frequency * M_PI / rate); float o2 = omega * omega; float o4 = o2 * o2; - float x1 = o2 + 2 * BWPB41 * omega + 4; - float x2 = o2 + 2 * BWPB42 * omega + 4; - float y1 = o2 - 2 * BWPB41 * omega + 4; - float y2 = o2 - 2 * BWPB42 * omega + 4; - float o228 = 2 * o2 - 8; + float x1 = o2 + 2.0f * (float)BWPB41 * omega + 4.0f; + float x2 = o2 + 2.0f * (float)BWPB42 * omega + 4.0f; + float y1 = o2 - 2.0f * (float)BWPB41 * omega + 4.0f; + float y2 = o2 - 2.0f * (float)BWPB42 * omega + 4.0f; + float o228 = 2.0f * o2 - 8.0f; float norm = x1 * x2; a.push_back(1); a.push_back((x1 + x2) * o228 / norm); diff --git a/intern/audaspace/FX/AUD_DelayReader.cpp b/intern/audaspace/FX/AUD_DelayReader.cpp index 903e043af01..0e9833cd07f 100644 --- a/intern/audaspace/FX/AUD_DelayReader.cpp +++ b/intern/audaspace/FX/AUD_DelayReader.cpp @@ -33,8 +33,8 @@ AUD_DelayReader::AUD_DelayReader(AUD_Reference reader, float delay) : AUD_EffectReader(reader), - m_delay(int(delay * reader->getSpecs().rate)), - m_remdelay(int(delay * reader->getSpecs().rate)) + m_delay(int((AUD_SampleRate)delay * reader->getSpecs().rate)), + m_remdelay(int((AUD_SampleRate)delay * reader->getSpecs().rate)) { } diff --git a/intern/audaspace/FX/AUD_HighpassFactory.cpp b/intern/audaspace/FX/AUD_HighpassFactory.cpp index 41070842596..b56be8942ff 100644 --- a/intern/audaspace/FX/AUD_HighpassFactory.cpp +++ b/intern/audaspace/FX/AUD_HighpassFactory.cpp @@ -48,8 +48,8 @@ void AUD_HighpassFactory::recalculateCoefficients(AUD_SampleRate rate, std::vector &b, std::vector &a) { - float w0 = 2 * M_PI * m_frequency / rate; - float alpha = sin(w0) / (2 * m_Q); + float w0 = 2.0 * M_PI * (AUD_SampleRate)m_frequency / rate; + float alpha = (float)(sin(w0) / (2.0 * (double)m_Q)); float norm = 1 + alpha; float c = cos(w0); a.push_back(1); diff --git a/intern/bsp/intern/BOP_CarveInterface.cpp b/intern/bsp/intern/BOP_CarveInterface.cpp index 93d15e6d5e6..49c999a1dd4 100644 --- a/intern/bsp/intern/BOP_CarveInterface.cpp +++ b/intern/bsp/intern/BOP_CarveInterface.cpp @@ -60,7 +60,7 @@ static bool isQuadPlanar(carve::geom3d::Vector &v1, carve::geom3d::Vector &v2, float production = carve::geom::dot(cross, vec3); float magnitude = 1e-5 * cross.length(); - return fabs(production) < magnitude; + return fabsf(production) < magnitude; } static bool isFacePlanar(CSG_IFace &face, std::vector &vertices) diff --git a/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp b/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp index efdf0134c4b..592ad114113 100644 --- a/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp +++ b/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp @@ -86,8 +86,8 @@ static void FHT(fREAL *data, unsigned int M, unsigned int inverse) fREAL *data_nbd = &data_n[bd]; fREAL *data_bd = &data[bd]; for (k = bl; k < len; k += istep) { - t1 = fc * data_n[k] + fs * data_nbd[k]; - t2 = fs * data_n[k] - fc * data_nbd[k]; + t1 = fc * (double)data_n[k] + fs * (double)data_nbd[k]; + t2 = fs * (double)data_n[k] - fc * (double)data_nbd[k]; data_n[k] = data[k] - t1; data_nbd[k] = data_bd[k] - t2; data[k] += t1; @@ -395,7 +395,7 @@ void GlareFogGlowOperation::generateGlare(float *data, MemoryBuffer *inputTile, // linear window good enough here, visual result counts, not scientific analysis //w = (1.f-fabs(u))*(1.f-fabs(v)); // actually, Hanning window is ok, cos^2 for some reason is slower - w = (0.5f + 0.5f * cos((double)u * M_PI)) * (0.5f + 0.5f * cos((double)v * M_PI)); + w = (0.5f + 0.5f * cosf(u * (float)M_PI)) * (0.5f + 0.5f * cosf(v * (float)M_PI)); mul_v3_fl(fcol, w); ckrn->writePixel(x, y, fcol); } diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index d8e6510a269..8f94086013c 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -785,7 +785,7 @@ static int file_extension_type(const char *relname) } else if (BLI_testextensie(relname, ".txt") || BLI_testextensie(relname, ".glsl") || - BLI_testextensie(relname, ".osl") || + BLI_testextensie(relname, ".osl") || BLI_testextensie(relname, ".data")) { return TEXTFILE; diff --git a/source/blender/imbuf/intern/cineon/logImageCore.c b/source/blender/imbuf/intern/cineon/logImageCore.c index 5c734db323d..3911e5c2ef3 100644 --- a/source/blender/imbuf/intern/cineon/logImageCore.c +++ b/source/blender/imbuf/intern/cineon/logImageCore.c @@ -947,7 +947,7 @@ static void getLogToLinLut(float *lut, LogImageFile *logImage, LogImageElement l softClip = 0; breakPoint = logImage->referenceWhite - softClip; - gain = logElement.maxValue / (1.0 - powf(10, (logImage->referenceBlack - logImage->referenceWhite) * step / negativeFilmGamma * logImage->gamma / 1.7f)); + gain = logElement.maxValue / (1.0f - powf(10, (logImage->referenceBlack - logImage->referenceWhite) * step / negativeFilmGamma * logImage->gamma / 1.7f)); offset = gain - logElement.maxValue; kneeOffset = powf(10, (breakPoint - logImage->referenceWhite) * step / negativeFilmGamma * logImage->gamma / 1.7f) * gain - offset; kneeGain = (logElement.maxValue - kneeOffset) / powf(5 * softClip, softClip / 100); diff --git a/source/blender/imbuf/intern/radiance_hdr.c b/source/blender/imbuf/intern/radiance_hdr.c index 53b00f441c8..72cec0e3749 100644 --- a/source/blender/imbuf/intern/radiance_hdr.c +++ b/source/blender/imbuf/intern/radiance_hdr.c @@ -154,7 +154,7 @@ static void FLOAT2RGBE(fCOLOR fcol, RGBE rgbe) if (d <= 1e-32f) rgbe[RED] = rgbe[GRN] = rgbe[BLU] = rgbe[EXP] = 0; else { - d = frexp(d, &e) * 256.f / d; + d = (float)frexp(d, &e) * 256.0f / d; rgbe[RED] = (unsigned char)(fcol[RED] * d); rgbe[GRN] = (unsigned char)(fcol[GRN] * d); rgbe[BLU] = (unsigned char)(fcol[BLU] * d); diff --git a/source/blender/render/intern/raytrace/svbvh.h b/source/blender/render/intern/raytrace/svbvh.h index 757ebc4c4d3..6ec75ebb527 100644 --- a/source/blender/render/intern/raytrace/svbvh.h +++ b/source/blender/render/intern/raytrace/svbvh.h @@ -93,7 +93,7 @@ static int svbvh_bb_intersect_test(const Isect *isec, const float *_bb) RE_RC_COUNT(isec->raycounter->bb.test); if (t1x > t2y || t2x < t1y || t1x > t2z || t2x < t1z || t1y > t2z || t2y < t1z) return 0; - if (t2x < 0.0 || t2y < 0.0 || t2z < 0.0) return 0; + if (t2x < 0.0f || t2y < 0.0f || t2z < 0.0f) return 0; if (t1x > isec->dist || t1y > isec->dist || t1z > isec->dist) return 0; RE_RC_COUNT(isec->raycounter->bb.hit); -- cgit v1.2.3