-
Notifications
You must be signed in to change notification settings - Fork 165
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
Detect word size for Windows properly #123
Conversation
The use of the |
In Windows SDK the _INTEGRAL_MAX_BITS is always 64 even when building for x86_32 targets, also _INTEGRAL_MAX_BITS means the max bits of integer, which does not necessarily equal to the word size, so it should be used at all. According to MSDN: _WIN32 Defined as 1 when the compilation target is 32-bit ARM, 64-bit ARM, x86, or x64. Otherwise, undefined. _WIN64 Defined as 1 when the compilation target is 64-bit ARM or x64. Otherwise, undefined. So we can use them as a more reliable way for word size on Windows.
Thanks for the background, I have removed the usage of For compatibility with MSVC, I have added another way to detect word size, which is officially documented. |
Maybe I'm missing something, but wouldn't it be possible to add two "generic"/C99 branches based on |
The purpose of this macro is to conditionally enable code in compile time, I think |
|
Thanks for the reference, according to MSDN this trick should work on msvc.
However for other platforms the general definition of On the other hand
|
@aklomp Putting the quest for a generic macro define aside, can you merge this PR and do a patch release first? Node.js updated base64 dep very recently and I would like to fix the broken build soon. |
Hi everyone, sorry for not weighing in on this issue, but unfortunately my availability is very limited right now. I hope to resolve this in one or two weeks at most. |
@zcbenz Thanks for your patience. I merged #125 instead of this PR because that fix looks a bit more portable by not doing platform detection, and you mentioned that it also solves this issue. Let me know if you still need a point release. I can do one, but I'd prefer to fix some other issues first (mainly #127). |
Thanks for looking in this, I'll just wait for a new release so I can update the dep in Node.js. |
@zcbenz I just released v0.5.2. |
In Windows SDK the
_INTEGRAL_MAX_BITS
is always 64 even when building for x86_32 targets, so it should not be used for detecting word size when compiling for Windows.Also
_INTEGRAL_MAX_BITS
means the max bits of integer, which does not necessarily equal to the word size, so it should be used as the last resort for detecting word size.Currently compiling Node.js for 32bit Windows with clang breaks because of this.