aboutsummaryrefslogtreecommitdiffstats
path: root/common.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--common.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/common.h b/common.h
index 864082c..2c8250c 100644
--- a/common.h
+++ b/common.h
@@ -4,6 +4,7 @@
#include <sys/stat.h>
#include <alloca.h>
#include <errno.h>
+#include <inttypes.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
@@ -16,6 +17,15 @@
/**
+ * Truncate an unsigned integer to an unsigned 32-bit integer
+ *
+ * @param X:uint_least32_t The value to truncate
+ * @return :uint_least32_t The 32 lowest bits in `X`
+ */
+#define TRUNC32(X) ((X) & (uint_least32_t)0xFFFFFFFFUL)
+
+
+/**
* Process a chunk using SHA-1 or SHA-0
*
* @param state The hashing state