From 910563941d0338fc8a5df701e0eff930068feb05 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Mon, 25 Jun 2012 13:37:19 +0900 Subject: [PATCH] add round_up utility function OF protocols need this in many places. Signed-off-by: FUJITA Tomonori Reviewed-by: Simon Horman --- ryu/utils.py | 4 ++++ 1 file changed, 4 insertions(+) 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