From 69f48f4663787de2f50cdaad030f7a0dc71c933e Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Fri, 6 Oct 2017 17:49:04 +0800 Subject: [PATCH] include/types.h: silence "-Wdouble-promotion" warnings avoid implicit promotion from float to double. Signed-off-by: Kefu Chai --- src/crush/CrushWrapper.h | 2 +- src/include/types.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/crush/CrushWrapper.h b/src/crush/CrushWrapper.h index 6026759c6ad96..73085b68a0d63 100644 --- a/src/crush/CrushWrapper.h +++ b/src/crush/CrushWrapper.h @@ -1457,7 +1457,7 @@ public: ostream *ss) { vector weight(weightf.size()); for (unsigned i = 0; i < weightf.size(); ++i) { - weight[i] = (int)(weightf[i] * (float)0x10000); + weight[i] = (int)(weightf[i] * (double)0x10000); } return choose_args_adjust_item_weight(cct, cmap, id, weight, ss); } diff --git a/src/include/types.h b/src/include/types.h index 5553ea8100173..c68f9e10ebdca 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -439,9 +439,9 @@ struct weightf_t { inline ostream& operator<<(ostream& out, const weightf_t& w) { - if (w.v < -0.01) { + if (w.v < -0.01F) { return out << "-"; - } else if (w.v < 0.000001) { + } else if (w.v < 0.000001F) { return out << "0"; } else { std::streamsize p = out.precision(); -- 2.39.5