0
$\begingroup$

The C standard carves out room for implementations which have padding bits in their integer types. Padding bits affect the size of an integer but not the number of possible values they can contain. I understand the purpose of padding bits/bytes in structs to ensure that they are properly aligned but including padding bits in primitive integer types seems unnecessary and pointless. This question refers to padding bits in int as 'outdated.' The answer refers to a 32-bit short stored in a 64-bit object making all the remaining 32 bits padding bits that serve no apparent purpose.

For what purpose would there be padding bits in integer types instead of just using all the bits in any given integer type as value bits or using a smaller integer type? What purpose did padding bits in primitive integers ever serve regardless how 'outdated' they are?

$\endgroup$

1 Answer 1

1
$\begingroup$

IIRC, Crays had a 23 bits integer type. This was really just their 32 bits floating point type with the exponent set to zero/ignored. If this idea sounds outdated, AVX-512 recently introduced a 52 bits Integer Fused Multiply & Add (IFMA). Same idea: ignore the exponent of a larger FP type.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.