Skip to content

Conversation

@ncopa
Copy link
Contributor

@ncopa ncopa commented Apr 24, 2024

Detect the MARISA_WORD_SIZE independent of architecture.

Fixes: #40
Fixes: #57
Fixes: #44
Fixes: #46
Fixes: #56

@ncopa
Copy link
Contributor Author

ncopa commented Apr 24, 2024

Tested on Alpine Linux on:

  • armv6
  • armv7
  • arm64
  • x86 (32bit)
  • x86 (64bit)
  • ppc64le
  • s390x
  • riscv64

https://gitlab.alpinelinux.org/alpine/aports/-/jobs/1359213

Detect the MARISA_WORD_SIZE independent of architecture.

Fixes: s-yata#40
Fixes: s-yata#57
Fixes: s-yata#44
Fixes: s-yata#46
Fixes: s-yata#56
@ncopa ncopa force-pushed the fix-wordsize-detection branch from 1e16775 to 6925413 Compare April 30, 2024 15:22
@ncopa
Copy link
Contributor Author

ncopa commented Apr 30, 2024

I updated the commit to use UINTPTR_MAX.

It seems that Visual C++ 2010 and newer at least provides stdint.h.
https://stackoverflow.com/questions/126279/c99-stdint-h-header-and-ms-visual-studio

Maybe we should do something like:

diff --git a/include/marisa/base.h b/include/marisa/base.h
index bddce4a..68e774b 100644
--- a/include/marisa/base.h
+++ b/include/marisa/base.h
@@ -2,7 +2,7 @@
 #define MARISA_BASE_H_
 
 // Old Visual C++ does not provide stdint.h.
-#ifndef _MSC_VER
+#if !defined(_MSC_VER) || (_MSC_VER >= 1600)
  #include <stdint.h>
 #endif  // _MSC_VER
 

@ncopa ncopa requested a review from jmr April 30, 2024 15:28
ziyao233 added a commit to ziyao233/eweos-packages that referenced this pull request Aug 3, 2024
This makes detection of MARISA_WORD_SIZE architecture independent.

Links: s-yata/marisa-trie#58
YukariChiba pushed a commit to eweOS/packages that referenced this pull request Aug 4, 2024
This makes detection of MARISA_WORD_SIZE architecture independent.

Links: s-yata/marisa-trie#58
@s-yata
Copy link
Owner

s-yata commented May 15, 2025

Hmm... I cannot remember the reason why I used architecture dependent macros.
It's not written in commit messages (in svndump downloaded from Google Code Archive).

I would like to merge this because it solves many similar issues and pull requests.

@s-yata s-yata added the bug label May 15, 2025
@s-yata
Copy link
Owner

s-yata commented May 15, 2025

I prefer to use UINT64_MAX and UINT32_MAX than 0xffffffffffffffff and 0xffffffff.
These macros are defined in stdint.h (or cstdint).

@s-yata s-yata merged commit 835919e into s-yata:master May 16, 2025
s-yata added a commit that referenced this pull request May 16, 2025
marisa-trie assumes that stdint.h is available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FAIL: base-test on riscv64 Add riscv64 support

3 participants