Closed pkrisz99 closed 1 year ago
As far as I know, __popcnt64 (and similar methods) are a compiler feature, and is not directly related to the OS.
For GCC, you can either replace these intrinsics with __builtin_popcount and likes, or alternatively you can use C++20 functions, such as std::popcount (though they seem to be a bit slower). All of these are in Utils.cpp.
Eventually, I will ditch MSVC in favor of GCC / Clang, since it was brought to my attention there's also performance reasons to do so, I just have to familiarize myself with makefiles first. If by any chance, you happen to create a working compilation for Linux, I would love to see the exact steps, it would help me a lot.
For GCC, you can either replace these intrinsics with __builtin_popcount and likes ..
indeed, i tried to 'repair' your code, esp. in Utils.cpp but i couldn't find Linux replacement code pieces to solve all compile errors .. i'm not into C++ but sometimes i manage .. thanks for the __builtin[..] tip, i already found some references to such syntax but not yet familiar .. i could find the time to solve this puzzle - i'll let you know then ..
No worries, thanks for the heads up. I'll look into it soon.
The last few commits have added support, and as far as I can tell it's working fine on Ubuntu. Clang is the preferred compiler as it seems to be about 10% faster, but g++ works as well.
I'll be closing this issue, but will reopen it if there's any weird behaviour.
@pkrisz99 i cloned the newest source : indeed it compiles fine (on Xubuntu 22.04) .. i use Clang++ 14.0.0 .. i did not alter the makefile .. i had no warnings, all went very well .. the binary is 2.7 Mb and runs fine in CuteChess.
Thanks for the feedback, I'm happy to hear that!
would be nice ! i'm a Linux user .. is it possible to write CPP code which is OS independent ? Eg. when using GCC i get errors about __popcnt64 and more : can all such typical Windows constructs be replaced by general ones ? Just a thought..