I want to load 16 bit unsigned integers from an array and use these values for 32 bit unsigned calculations in C++. I have the choice between storing the values as 16 bit array (less memory) or 32 bit array (more memory consumption).
My code should be compilable with common C++ compilers and run on as many architectures as possible. It will be difficult to do performance measurement and assembler code reading for many of these combinations, so I am asking for a theoretical examination.
In other words: Under which conditions does a 16 bit to 32 bit unsigned integer conversion usually consume CPU cycles? When can I expect to use the memory reduced 16 bit array without loosing CPU cycles?