summaryrefslogtreecommitdiff
path: root/src/lib/util.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-03-03 12:54:07 +0000
committerCarl Hetherington <cth@carlh.net>2014-03-03 12:54:07 +0000
commit1629bd7df2150156109afbc7a16677cb29e82adf (patch)
treef8d42b82976bf999eafd1abd499027a5ea5be02e /src/lib/util.cc
parentcc3900735839ff4b0da0c046b5c606c440ba917a (diff)
parentf0738a22fc7555c306d49bcd1c356ce210e2c0e2 (diff)
Merge master.
Diffstat (limited to 'src/lib/util.cc')
-rw-r--r--src/lib/util.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/lib/util.cc b/src/lib/util.cc
index 725039a7e..7089ef2a5 100644
--- a/src/lib/util.cc
+++ b/src/lib/util.cc
@@ -1026,3 +1026,13 @@ entities_to_text (string e)
boost::algorithm::replace_all (e, "%2F", "/");
return e;
}
+
+int64_t
+divide_with_round (int64_t a, int64_t b)
+{
+ if (a % b >= (b / 2)) {
+ return (a + b - 1) / b;
+ } else {
+ return a / b;
+ }
+}