aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/patches/marisa-fix-MARISA_WORD_SIZE.patch
blob: 143ab6ac6be9e34a997af5d5667b8cdfb83f34d6 (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
from https://github.com/s-yata/marisa-trie/pull/58.patch

From 6925413d873cec8fd4cabb360fd512be8abc4551 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Wed, 24 Apr 2024 11:17:09 +0200
Subject: [PATCH] Fix detection of MARISA_WORD_SIZE

Detect the MARISA_WORD_SIZE independent of architecture.

Fixes: https://github.com/s-yata/marisa-trie/issues/40
Fixes: https://github.com/s-yata/marisa-trie/issues/57
Fixes: https://github.com/s-yata/marisa-trie/pull/44
Fixes: https://github.com/s-yata/marisa-trie/pull/46
Fixes: https://github.com/s-yata/marisa-trie/pull/56
---
 include/marisa/base.h | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/include/marisa/base.h b/include/marisa/base.h
index ffcdc5b..bddce4a 100644
--- a/include/marisa/base.h
+++ b/include/marisa/base.h
@@ -28,14 +28,13 @@ typedef uint32_t marisa_uint32;
 typedef uint64_t marisa_uint64;
 #endif  // _MSC_VER
 
-#if defined(_WIN64) || defined(__amd64__) || defined(__x86_64__) || \
-    defined(__ia64__) || defined(__ppc64__) || defined(__powerpc64__) || \
-    defined(__sparc64__) || defined(__mips64__) || defined(__aarch64__) || \
-    defined(__s390x__)
+#if (UINTPTR_MAX == 0xffffffffffffffff)
  #define MARISA_WORD_SIZE 64
-#else  // defined(_WIN64), etc.
+#elif (UINTPTR_MAX == 0xffffffff)
  #define MARISA_WORD_SIZE 32
-#endif  // defined(_WIN64), etc.
+#else
+ #error Failed to detect MARISA_WORD_SIZE
+#endif
 
 //#define MARISA_WORD_SIZE  (sizeof(void *) * 8)