]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
include/types.h: silence "-Wdouble-promotion" warnings
authorKefu Chai <kchai@redhat.com>
Fri, 6 Oct 2017 09:49:04 +0000 (17:49 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 9 Oct 2017 02:38:08 +0000 (10:38 +0800)
avoid implicit promotion from float to double.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crush/CrushWrapper.h
src/include/types.h

index 6026759c6ad96a93ea0d5c63e61c7f3d3796f3be..73085b68a0d637578e64bfa3eac7f483764c4f70 100644 (file)
@@ -1457,7 +1457,7 @@ public:
     ostream *ss) {
     vector<int> 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);
   }
index 5553ea8100173abb7a52148cba91fb5b1e92f7ea..c68f9e10ebdcaefdf6eb5e36c44164326800d1b4 100644 (file)
@@ -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();