Wouldn't this be better with bitfields?

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Wed Jul 3 01:39:02 UTC 2024


On 03/07/2024 11:32 AM, Walter Bright wrote:
> That's just to initialize it. Never mind the shift/mask code to read a 
> fields, or change just one of the fields. There's a large number of 
> these functions in instr.d. Wouldn't it be better with:
> 
> |struct addsub_imm { uint Rd:5, Rn:5, imm12:12, sh:1, x22:6, S:1, op:1, 
> sf: 1; } |
> 
> ??

Absolutely!

Especially with the reassurances that changing your target or platform 
won't end up changing what it does!


More information about the Digitalmars-d mailing list