Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix detection of MARISA_WORD_SIZE #58

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ncopa
Copy link

@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
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

include/marisa/base.h Outdated Show resolved Hide resolved
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
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FAIL: base-test on riscv64 Add riscv64 support
2 participants