aboutsummaryrefslogtreecommitdiffstats
path: root/common.h
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2022-07-07 14:32:58 +0200
committerMattias Andrée <maandree@kth.se>2022-07-07 14:32:58 +0200
commit811a82296969a037d1e580d65bb5a73241ffae1f (patch)
tree404759c5e429d450c91f110497758424fb4eaf1d /common.h
parentDon't marshal w (diff)
downloadlibsha1-811a82296969a037d1e580d65bb5a73241ffae1f.tar.gz
libsha1-811a82296969a037d1e580d65bb5a73241ffae1f.tar.bz2
libsha1-811a82296969a037d1e580d65bb5a73241ffae1f.tar.xz
Use uint_least32_t instead of uint32_t
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'common.h')
-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