summaryrefslogtreecommitdiffstats
path: root/src/fastd.h
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-10-31 23:11:00 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-10-31 23:11:00 +0100
commit542861816d8305afa113653a84073be2fca68e50 (patch)
tree16f2f302a87ed73c35204e6606e4339b00c051fc /src/fastd.h
parent66a953a83f162ed5e096d75a5ddf4e2a80ea15b3 (diff)
downloadfastd-542861816d8305afa113653a84073be2fca68e50.tar
fastd-542861816d8305afa113653a84073be2fca68e50.zip
Implement HKDF
Diffstat (limited to 'src/fastd.h')
-rw-r--r--src/fastd.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/fastd.h b/src/fastd.h
index c24781f..2c3de6a 100644
--- a/src/fastd.h
+++ b/src/fastd.h
@@ -407,8 +407,12 @@ static inline int fastd_rand(fastd_context_t *ctx, int min, int max) {
(type *)( (char *)__mptr - offsetof(type,member) );})
+static inline size_t block_count(size_t l, size_t a) {
+ return (l+a-1)/a;
+}
+
static inline size_t alignto(size_t l, size_t a) {
- return ((l+a-1)/a)*a;
+ return block_count(l, a)*a;
}
static inline fastd_buffer_t fastd_buffer_alloc(const fastd_context_t *ctx, size_t len, size_t head_space, size_t tail_space) {