diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-03-03 12:54:07 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-03-03 12:54:07 +0000 |
| commit | 1629bd7df2150156109afbc7a16677cb29e82adf (patch) | |
| tree | f8d42b82976bf999eafd1abd499027a5ea5be02e /src/lib/util.cc | |
| parent | cc3900735839ff4b0da0c046b5c606c440ba917a (diff) | |
| parent | f0738a22fc7555c306d49bcd1c356ce210e2c0e2 (diff) | |
Merge master.
Diffstat (limited to 'src/lib/util.cc')
| -rw-r--r-- | src/lib/util.cc | 10 |
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; + } +} |
