summaryrefslogtreecommitdiff
path: root/src/or/or.h
diff options
context:
space:
mode:
authorKarsten Loesing <karsten.loesing@gmx.net>2009-07-11 00:44:27 +0200
committerKarsten Loesing <karsten.loesing@gmx.net>2009-07-11 00:44:27 +0200
commitd1437245c77b930382f9b36355a3fa67d48ecb38 (patch)
tree1043fa7acc4ae8bac7f62ff9319ca45c953525e3 /src/or/or.h
parent7fb206e554db6290ed355cd7fda7d2bcfb23c89f (diff)
downloadtor-d1437245c77b930382f9b36355a3fa67d48ecb38.tar.gz
tor-d1437245c77b930382f9b36355a3fa67d48ecb38.zip
Simplify the math to round up to the next multiple of some value.
Diffstat (limited to 'src/or/or.h')
-rw-r--r--src/or/or.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/or/or.h b/src/or/or.h
index f298d53c27..be38035af7 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -2669,6 +2669,16 @@ struct socks_request_t {
* every connection. */
};
+/** Return the lowest x such that x is at least <b>number</b>, and x modulo
+ * <b>divisor</b> == 0. */
+static INLINE unsigned
+round_to_next_multiple_of(unsigned number, unsigned divisor)
+{
+ number += divisor - 1;
+ number -= number % divisor;
+ return number;
+}
+
/* all the function prototypes go here */
/********************************* buffers.c ***************************/