Skip to content

Conversation

R-Goc
Copy link

@R-Goc R-Goc commented Aug 28, 2025

This commit make MP_DIGIT 64 bit when using clang-cl. It also explicitly sets compile flags for clang-cl.

@R-Goc
Copy link
Author

R-Goc commented Aug 28, 2025

This also allows for building a debug version with clang-cl. I couldn't get it to happen with msvc. As in if I did the things required for it it is no longer a debug build as it would require at least turning off real time checks (/RTC1 passed by cmake) which defeats the purpose of a debug build. Maybe I am missing something here.
Other than that on msvc there are still some warnings:

E:\lib\libtommath\mp_get_i64.c(6): warning C4146: unary minus operator applied to unsigned type, result still unsigned
[38/166] Building C object CMakeFiles\libtommath.dir\mp_get_i32.c.obj
E:\lib\libtommath\mp_get_i32.c(6): warning C4146: unary minus operator applied to unsigned type, result still unsigned
[46/166] Building C object CMakeFiles\libtommath.dir\mp_get_l.c.obj
E:\lib\libtommath\mp_get_l.c(6): warning C4146: unary minus operator applied to unsigned type, result still unsigned
[102/166] Building C object CMakeFiles\libtommath.dir\mp_set_i64.c.obj
E:\lib\libtommath\mp_set_i64.c(6): warning C4146: unary minus operator applied to unsigned type, result still unsigned
[103/166] Building C object CMakeFiles\libtommath.dir\mp_set_l.c.obj
E:\lib\libtommath\mp_set_l.c(6): warning C4146: unary minus operator applied to unsigned type, result still unsigned
[104/166] Building C object CMakeFiles\libtommath.dir\mp_set_i32.c.obj
E:\lib\libtommath\mp_set_i32.c(6): warning C4146: unary minus operator applied to unsigned type, result still unsigned
[162/166] Building C object demo\CMakeFiles\test-ltm.dir\test.c.obj
E:\lib\libtommath\demo\test.c(54): warning C4146: unary minus operator applied to unsigned type, result still unsigned
E:\lib\libtommath\demo\test.c(59): warning C4146: unary minus operator applied to unsigned type, result still unsigned

This commit make MP_DIGIT 64 bit when using clang-cl. It also explicitly
sets compile flags for clang-cl.
@R-Goc
Copy link
Author

R-Goc commented Aug 29, 2025

My only concern is what happens if tommath is compiled with msvc but the consumer uses clang-cl. At that point everything will break I am afraid. Is MP_WORD anywhere in the ABI of the library? If so then that could also cause issues as __int128 is not stable in the msvc ABI and afaik not even defined.

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.

1 participant