On 2015-12-17 14:50, Andrey Semashev wrote: > On 2015-12-17 02:44, Kamil Rytarowski wrote: >> >> On 16.12.2015 11:02, Pali Rohár wrote: >>> >>> Hi! There is probably no portable way for checking CPU type. But >>> you do not need to know CPU type here. You need to know if CPU has >>> fast 64bit numeric operations (and use 64bit speed optimization), >>> right? >>> >>> And this could be possible by checking size of int_fast32_t type >>> (defined in stdint.h). If is same as size of int_fast64_t type then >>> you could use 64bit optimization otherwise not (= 32bit integers >>> are faster then 64bit). >>> >>> But I will let this suggestion for reviewing of other people. >> >> This sounds like a good way to go. > > I don't think it does. int_fast32_t does not have to be 64-bit if 32-bit > integers are fast. It _may_ be larger than 32-bit if 32-bit integers are > slow (most likely - do not have the target hardware support). I don't > think this is the case for x32 or x86_64. > > If integer performance is what this preprocessor check influences, I'd > suggest checking the size of size_t. Or testing for particular > architectures explicitly, with 64-bit being the default and 32-bit only > for the tested architectures (this would probably make the code more > easily maintainable in the future). I've sent this privately in error. Also, it seems size_t is 32-bit on x32, so disregard that suggestion.