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,213 of 243,242   
   bart to BGB   
   Re: _BitInt(N)   
   28 Nov 25 22:43:36   
   
   From: bc@freeuk.com   
      
   On 28/11/2025 19:09, BGB wrote:   
      
   > It is also possible to compose values of _UBitInt and similar, say:   
   >    _UBitInt(24) rgb24;   
   >    _UBitInt(16) rgb5;   
   >    rgb5=(_UBitInt(16)) { 0b0u1, rgb24[23:19], rgb24[15:11], rgb24[7:3] };   
      
   This has given me an idea for an extended feature. Here, I would use   
   rgb.[x] syntax, where x is maybe 23, or 23..19, and rgb.[x, y] just   
   means rgb.[x].[y].   
      
   The latter is not that useful however; suppose that rgb.[x, y] actually   
   combines rgb.[x] and rgb.[y]. That could then be used to express your   
   example like this:   
      
       rgb24.[23..19, 15..11, 7..3]   
      
   So the 3 distinct 5-bit bitfields are concatenated into one 15-bit field.   
      
   However the exact meaning and ordering would still need pinning down,   
   and there are various questions to be answered. I also think that such   
   extaction can be a separate feature from packing multiple sub-word   
   values into one result.   
      
   I think this might be worth looking at. But I'm still not keen on   
   relying on the type system to give you the lengths of those fields. (In   
   my language, rgb.[23..19] is extracted into an i64 value so its bitfield   
   info is lost.)   
      
   --- 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