Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.arch    |    Apparently more than just beeps & boops    |    131,241 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 129,870 of 131,241    |
|    Brian G. Lucas to Kent Dickey    |
|    Re: sign/zero/garbage extension    |
|    09 Oct 25 16:30:38    |
      From: bagel99@gmail.com              On 10/6/25 8:38 PM, Kent Dickey wrote:       [SNIP]       > For C and C++ code, the standard dictates that all integer operations are       > done with "int" precision, unless some operand is larger than int, and then       > do it in that precision. So there's no real need for 8-bit and 16-bit       > operations to be natively by the CPU--these operations are actually done       > as int's already. If you have a variable which is a byte, then assigning       > to that variable, and then using that variable again you will need to       > zero-extend, but honestly, this is not usually a performance path. It's       > likely to be stored to memory instead, so no masking or sign extending       > should be needed.       >       [SNIP]       > Kent              Can you point me to the section in "the standard" which indicates       'all integer operations are done with "int" precision'?              What if the wording was changed to:       'all integer operations are done with _at least_ "int" precision',       e.g. one could use long. Would that break conforming code?              Brian              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca