Skip to content

Commit

Permalink
Fix detection of MARISA_WORD_SIZE
Browse files Browse the repository at this point in the history
Detect the MARISA_WORD_SIZE independent of architecture.

Fixes: #40
Fixes: #57
Fixes: #44
Fixes: #46
Fixes: #56
  • Loading branch information
ncopa committed Apr 24, 2024
1 parent 006020c commit 1e16775
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions include/marisa/base.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef MARISA_BASE_H_
#define MARISA_BASE_H_

#include <limits.h>
// Old Visual C++ does not provide stdint.h.
#ifndef _MSC_VER
#include <stdint.h>
Expand Down Expand Up @@ -28,14 +29,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 (ULONG_MAX == 0xffffffffffffffff)
#define MARISA_WORD_SIZE 64
#else // defined(_WIN64), etc.
#elif (ULONG_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)

Expand Down

0 comments on commit 1e16775

Please sign in to comment.