-
John Mather authored
commit b0755ac2 Author: John Mather <johnmather@sidefx.com> Date: Sun Sep 22 00:46:16 2024 -0400 Removed extraneous code from Windows porting process commit 88b637ab Author: John Mather <johnmather@sidefx.com> Date: Sun Sep 22 00:27:01 2024 -0400 Add Windows support This commit adds Windows support to core-math. All tests have been run and results have been verified for accuracy on both Windows and Linux. In order to build to build core-math on Windows, you must use a GNU-compatible compiler such as mingw due to our reliance on GNU builtin functions. In my development, I utilized the mingw-w64-ucrt-x86_64-gcc package provided by msys2 to target the native UCRT runtime. Compilation under Cygwin may work as well, but the produced binaries will rely on Cygwin's runtime, making it less portable. While I've run all of the tests, I haven't included the code that I needed to port to do so as our current code structure doesn't lend itself well to utility functions shared across multiple files. Functions that needed to be ported were the non-standard getline and rand48 functions. I may contribute these functions in the future when we have a better way of sharing code between modules. A large number of the issues that I ran into were caused by differences in type length. long is 32 bits on Windows, and 64 bits on x86-64 Linux platforms. Because of this, there were many numerical and arithmetic over and underflows that produced incorrect results. I've changed the requisite types to int64_t and uint64_t where applicable. Likewise calls to builtins such as __builtin_clzl needed to be changed to the long long version __builtin_clzll as long long is the same size on both Windows and x86-64 Linux platforms. Many hard-coded constants in the form 0xffffl also needed to be changed to their long long counterparts - 0xffffll.
d6805168
Loading