summaryrefslogtreecommitdiff
path: root/src/load-graph.cpp
diff options
context:
space:
mode:
authorinfirit <[email protected]>2014-12-17 16:01:53 +0100
committerinfirit <[email protected]>2014-12-17 17:23:02 +0100
commitc9be17a1d0d6c2877407a15525de8f7b40c74d8c (patch)
tree43c881592d6bc92095101d79fba7110b0e7e990b /src/load-graph.cpp
parentab23523d7ae2b62d7c633773739e7694a0ce82a2 (diff)
downloadmate-system-monitor-c9be17a1d0d6c2877407a15525de8f7b40c74d8c.tar.bz2
mate-system-monitor-c9be17a1d0d6c2877407a15525de8f7b40c74d8c.tar.xz
Fix for issues on 32-bit machines
Taken from GSM commit: 843cc40119d36873f9670975c7815fbd38481093 From: Chris Kühl <[email protected]> Gnome bug: Fix for issues on 32-bit machines
Diffstat (limited to 'src/load-graph.cpp')
-rw-r--r--src/load-graph.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/load-graph.cpp b/src/load-graph.cpp
index 176b69f..3a387d3 100644
--- a/src/load-graph.cpp
+++ b/src/load-graph.cpp
@@ -410,7 +410,7 @@ net_scale (LoadGraph *g, guint64 din, guint64 dout)
new_max = 1.1 * new_max;
// make sure max is not 0 to avoid / 0
// default to 125 bytes == 1kbit
- new_max = std::max(new_max, 125UL);
+ new_max = std::max(new_max, G_GUINT64_CONSTANT(125));
} else {
// round up to get some extra space
@@ -418,7 +418,7 @@ net_scale (LoadGraph *g, guint64 din, guint64 dout)
new_max = 1.1 * new_max;
// make sure max is not 0 to avoid / 0
// default to 1 KiB
- new_max = std::max(new_max, 1024UL);
+ new_max = std::max(new_max, G_GUINT64_CONSTANT(1024));
// decompose new_max = coef10 * 2**(base10 * 10)
// where coef10 and base10 are integers and coef10 < 2**10
@@ -428,8 +428,8 @@ net_scale (LoadGraph *g, guint64 din, guint64 dout)
guint64 pow2 = std::floor(log2(new_max));
guint64 base10 = pow2 / 10.0;
- guint64 coef10 = std::ceil(new_max / double(1UL <<(base10 * 10)));
- g_assert(new_max <= (coef10 * (1UL << (base10 * 10))));
+ guint64 coef10 = std::ceil(new_max / double(G_GUINT64_CONSTANT(1) << (base10 * 10)));
+ g_assert(new_max <= (coef10 * (G_GUINT64_CONSTANT(1) << (base10 * 10))));
// then decompose coef10 = x * 10**factor10
// where factor10 is integer and x < 10
@@ -442,13 +442,16 @@ net_scale (LoadGraph *g, guint64 din, guint64 dout)
if (coef10 % g->num_bars() != 0)
coef10 = coef10 + (g->num_bars() - coef10 % g->num_bars());
g_assert(coef10 % g->num_bars() == 0);
-
- new_max = coef10 * (1UL << guint64(base10 * 10));
- procman_debug("bak %lu new_max %lu pow2 %lu coef10 %lu", bak_max, new_max, pow2, coef10);
+ new_max = coef10 * (G_GUINT64_CONSTANT(1) << guint64(base10 * 10));
+ procman_debug("bak %" G_GUINT64_FORMAT " new_max %" G_GUINT64_FORMAT
+ "pow2 %" G_GUINT64_FORMAT " coef10 %" G_GUINT64_FORMAT,
+ bak_max, new_max, pow2, coef10);
}
if (bak_max > new_max) {
- procman_debug("overflow detected: bak=%lu new=%lu", bak_max, new_max);
+ procman_debug("overflow detected: bak=%" G_GUINT64_FORMAT
+ " new=%" G_GUINT64_FORMAT,
+ bak_max, new_max);
new_max = bak_max;
}
@@ -466,7 +469,10 @@ net_scale (LoadGraph *g, guint64 din, guint64 dout)
}
}
- procman_debug("rescale dmax = %lu max = %lu new_max = %lu", dmax, g->net.max, new_max);
+ procman_debug("rescale dmax = %" G_GUINT64_FORMAT
+ " max = %" G_GUINT64_FORMAT
+ " new_max = %" G_GUINT64_FORMAT,
+ dmax, g->net.max, new_max);
g->net.max = new_max;