summaryrefslogtreecommitdiff
path: root/dev-libs/sord/files/sord-0.16.6-x86_32.patch
blob: 3effc4d44dc34cd605e7d9f704707f97106690a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
diff --git a/src/zix/digest.c b/src/zix/digest.c
index 889cfde..00b9fcf 100644
--- a/src/zix/digest.c
+++ b/src/zix/digest.c
@@ -38,10 +38,12 @@ zix_digest_add(uint32_t hash, const void* const buf, const size_t len)
 {
 	const uint8_t* str = (const uint8_t*)buf;
 
+#ifdef __x86_64__
 	for (size_t i = 0; i < (len / sizeof(uint64_t)); ++i) {
 		hash = (uint32_t)_mm_crc32_u64(hash, *(const uint64_t*)str);
 		str += sizeof(uint64_t);
 	}
+#endif
 	if (len & sizeof(uint32_t)) {
 		hash = _mm_crc32_u32(hash, *(const uint32_t*)str);
 		str += sizeof(uint32_t);
@@ -57,6 +59,7 @@ zix_digest_add(uint32_t hash, const void* const buf, const size_t len)
 	return hash;
 }
 
+#ifdef __x86_64__
 ZIX_API uint32_t
 zix_digest_add_64(uint32_t hash, const void* const buf, const size_t len)
 {
@@ -72,12 +75,17 @@ zix_digest_add_64(uint32_t hash, const void* const buf, const size_t len)
 
 	return hash;
 }
+#endif
 
 ZIX_API uint32_t
 zix_digest_add_ptr(const uint32_t hash, const void* const ptr)
 {
 #if UINTPTR_MAX == UINT64_MAX
-	return (uint32_t)_mm_crc32_u64(hash, (uintptr_t)ptr);
+	#ifdef __x86_64__
+		return (uint32_t)_mm_crc32_u64(hash, (uintptr_t)ptr);
+	#else
+		return (uint32_t)_mm_crc32_u32(hash, (uintptr_t)ptr);
+	#endif
 #else
 	return _mm_crc32_u32(hash, (uintptr_t)ptr);
 #endif