3/22/2026 at 1:02:48 AM
You're supposed to know that bitfields undergo promotion as they were small integers, even if they are declared to be something like unsigned int.Therefore, convert the values before operating on them:
u1 = ((uint64_t) bf.uf1) << 20;
u2 = ((uint64_t) bf.uf2) << 20;
by kazinator
3/22/2026 at 1:37:38 AM
I just can agree with any interpretation of the article's code that believes programmers should desire silent sign extension when everything about the expression and data types involved is explicitly written to avoid signedness. At the end of the day, programming languages should naturally express intent and not rely on memorization of surprise. Here, I believe that Microsoft correctly employed principle of least surprise, and that ultimately the spec is broken and because of the amount of code in existence just can't be fixed.by tyfighter