summaryrefslogtreecommitdiffstats
path: root/src/fastd.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/fastd.h')
-rw-r--r--src/fastd.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/fastd.h b/src/fastd.h
index 3981f46..d7946ea 100644
--- a/src/fastd.h
+++ b/src/fastd.h
@@ -283,6 +283,10 @@ static inline int fastd_rand(fastd_context *ctx, int min, int max) {
(type *)( (char *)__mptr - offsetof(type,member) );})
+static inline size_t alignto(size_t l, size_t a) {
+ return ((l+a-1)/a)*a;
+}
+
static inline fastd_buffer fastd_buffer_alloc(size_t len, size_t head_space, size_t tail_space) {
size_t base_len = head_space+len+tail_space;
uint8_t *ptr = malloc(base_len);
@@ -354,8 +358,6 @@ static inline void fastd_string_stack_free(fastd_string_stack *str) {
}
}
-#define ALIGN(l, a) (((l+a-1)/a)*a)
-
static inline bool timespec_after(const struct timespec *tp1, const struct timespec *tp2) {
return (tp1->tv_sec > tp2->tv_sec ||
(tp1->tv_sec == tp2->tv_sec && tp1->tv_nsec > tp2->tv_nsec));