summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2012-06-25 13:37:19 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2012-06-25 14:43:24 +0900
commit910563941d0338fc8a5df701e0eff930068feb05 (patch)
treeada5f2e67a4a48e71b4803a597acdd794e7cd613
parentb0d77225fd1ba92123836fcaf0a595a3715584df (diff)
add round_up utility function
OF protocols need this in many places. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Reviewed-by: Simon Horman <horms@verge.net.au>
-rw-r--r--ryu/utils.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/ryu/utils.py b/ryu/utils.py
index a14929b9..1bc7ea3f 100644
--- a/ryu/utils.py
+++ b/ryu/utils.py
@@ -61,3 +61,7 @@ def find_flagfile(default_path=RYU_DEFAULT_FLAG_FILE):
sys.argv.insert(1, flagfile)
LOG.debug('flagfile = %s', filename)
return
+
+
+def round_up(x, y):
+ return ((x + y - 1) / y) * y