intel / ARM_NEON_2_x86_SSE

The platform independent header allowing to compile any C/C++ code containing ARM NEON intrinsic functions for x86 target systems using SIMD up to AVX2 intrinsic functions
Other
430 stars 149 forks source link

warning C4311: 'type cast': pointer truncation on 64bit #11

Closed vladtepesch closed 6 years ago

vladtepesch commented 6 years ago

when checking the input pointer alignment in numerous vld* functions (--> macro LOAD_SI128): the pointer should be casted to uintptr_t instead of unsigned long

Zvictoria commented 6 years ago

Hi there. Well, is the warning mentioned the only problem you have? To be honest I don't remember the actual reason behind unsigned long usage but there should be the one definitely (some compilers compatibility?). Therefore I'd prefer to leave it as is for now if no actual problems seen just warnings

vladtepesch commented 6 years ago

the problem is that on 64bit architecures an unsigned long is not necesarily 64bit wide. changing it to uintptr_t guarantees that the pointer fits in and does not trigger this warning. of course - only the lower 4 bits are tested, so truncating the pointer does not matter, but every inclusion of the header produces a huge load of compiler warning and especially this kind of warning usually is of the kind you do not want to suppress on a global level.

Edit: On MSVC its a level 1 (highest) warning