Reply to post: "No point wasting time processing unused bits"

Keen to go _ExtInt? LLVM Clang compiler adds support for custom width integers

LDS Silver badge

"No point wasting time processing unused bits"

Only if the system architecture (CPU. memory, ecc.) supports it.

When you have fixed size registers, the CPU will act on the whole register size regardless of how many bits you define as "used". Sometimes using the smaller registers (like the 8-bit ones in the Intel architecture) may mean slower performances. Actually if say you define a 11 bit integer, the compiler will need to add more instructions to properly work on them, as CPU native instruction will expect a different format.

It may use less memory (remember the "packed" specifier in Pascal?), but once again most modern architectures have a performance hit when data are not aligned along some boundary - and CPU caches will anyway move blocks of some size anyway.

I fully understand the value of saving bits in architectures like FPGA where resources are contrained - on others it may just lead to new "Y2K" problems in the future, without any real saving.

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon

Biting the hand that feeds IT © 1998–2021