home bbs files messages ]

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,258 of 243,242   
   Philipp Klaus Krause to All   
   Re: _BitInt(N)   
   30 Nov 25 11:41:52   
   
   From: pkk@spth.de   
      
   Am 30.11.25 um 11:22 schrieb Michael S:   
   >   
   > I fail to see the difficulty for implementer.   
   > For arithmetic ops, _BitInt(1187) is almost the same as _BitInt(1216).   
   > You just add one 'and by constant' operation applied to MS word at the   
   > very end. You only have do it for unsigned variant, since for signed   
   > variant overflow is undefined, anyway. So, for signed, you can do   
   > nothing or you can do the same as unsigned, if you fill that it's   
   > simpler.   
   > The same goes for left shift.   
   > For right shift and for logical ops,  _BitInt(1187) is exactly the same   
   > as _BitInt(1216).   
   > So what is all the fuss about?   
      
   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.   
      
   Philipp   
      
   --- 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