Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.c    |    Meh, in C you gotta define EVERYTHING    |    243,242 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 242,263 of 243,242    |
|    Philipp Klaus Krause to All    |
|    Re: _BitInt(N)    |
|    30 Nov 25 13:35:02    |
      From: pkk@spth.de              Am 30.11.25 um 12:28 schrieb David Brown:       >>       >> I see two implementation strategies:       >>       >> * Just ignore the values of the padding bits. You don't need to and or       >> anything after arithmetic operations. Makes arithmetic as fast as       >> possible. But you need special handling at comparisons and casts.       >>       >> * Always keep the padding bits in line with the value, i.e. and after       >> arithemetic operations for unsigned, copy value of sign bit for       >> signed. Extra effort at arithmetic operations, but no extra effort at       >> casts and comparisons.       >>       >       > That sounds about right. It's much the same as the implementation of       > _Bool. You either ignore the padding bits while doing the calculations       > and filter them out when they later get in the way, or you keep them       > neat and consistent (signed or unsigned extended, as appropriate) during       > calculations and it's all fine for other operations. I have no idea       > what might be the most efficient choice overall - it could vary by       > application, but I expect implementations to have one fixed strategy.       >              _Bool is a bit different, since it promotes to int, so we don't really       have arithemetic directly on _Bool: I can definitely see an       implementation going one way for _BitInt, and the other for _Bool.              --- 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