double timediff(struct timeval *begin, struct timeval *end);
double elapsedtime(struct timeval *begin);
+
+#ifndef offsetof
+#define offsetof(type, field) ((int) &((type *)0)->field)
+#endif /* offsetof */
+
+#ifndef TYPEALIGN
+#define TYPEALIGN(ALIGNVAL,LEN) \
+ (((long) (LEN) + ((ALIGNVAL) - 1)) & ~((long) ((ALIGNVAL) - 1)))
+
+#define SHORTALIGN(LEN) TYPEALIGN(sizeof(int16_t), (LEN))
+#define INTALIGN(LEN) TYPEALIGN(sizeof(int32_t), (LEN))
+#define MAXALIGN(LEN) TYPEALIGN(sizeof(int64_t), (LEN))
+#define PTRALIGN(LEN) TYPEALIGN(sizeof(void*), (LEN))
+#endif
+
#endif