digitalmars.D.bugs - [Issue 4937] New: std.bitmanip: Allow repeated (identical) bitfield declarations
- d-bugmail puremagic.com (34/34) Sep 24 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4937
- d-bugmail puremagic.com (10/10) Sep 24 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4937
- d-bugmail puremagic.com (10/10) Sep 24 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4937
- d-bugmail puremagic.com (48/54) Jul 31 2012 http://d.puremagic.com/issues/show_bug.cgi?id=4937
- d-bugmail puremagic.com (6/6) Feb 26 2013 http://d.puremagic.com/issues/show_bug.cgi?id=4937
http://d.puremagic.com/issues/show_bug.cgi?id=4937 Summary: std.bitmanip: Allow repeated (identical) bitfield declarations Product: D Version: D2 Platform: All OS/Version: Windows Status: NEW Severity: enhancement Priority: P2 Component: Phobos AssignedTo: nobody puremagic.com ReportedBy: ah08010-d yahoo.com PDT --- I'm trying to describe an opcode layout - the arrangement of bits used by a CPU - and the resulting description is generally a union of bitfields: opcode, displacement opcode, register, register, register opcode, constant ...etc In my case, the opcode represents a common prefix, which leaves me declaring something like this in D: opcode, displacement "", register, register, register "", constant I would prefer, for reasons of clarity, to be able to repeat the declaration of opcode - the best comment is source code, as it were. So I would like the bitmanip code to permit redeclaration of bitfields that are identical in all respects. That is, obviously the names are the same, but the field width, offset, and type representation has to be the same as well. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 24 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4937 Andrei Alexandrescu <andrei metalanguage.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED CC| |andrei metalanguage.com AssignedTo|nobody puremagic.com |andrei metalanguage.com -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 24 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4937 bearophile_hugs eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs eml.cc See also bug 4425 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 24 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4937 Era Scarecrow <rtcvb32 yahoo.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rtcvb32 yahoo.com ---Also, I think I'm going to request that repeated bitfield definitions be allowed if they are identical - I'd like to redeclare "opcode" rather than "".How would you tell them apart? If i know how you may want to call them, i may be able to make something. I can understand with registers, but still need some way to work with them. Perhaps as a set then?So I would like the bitmanip code to permit redeclaration of bitfields that are identical in all respects.That is, obviously the names are the same, but the field width, offset, and type representation has to be the same as well.Maybe....? struct S { mixin(bitfields!( uint, "opcode", 4, uint, "register", 4, uint, "register", 4, uint, "register", 4 )); } and using the registers would have function signature like... struct Register { uint register_1; uint register_2; uint register_3; } //setters, likely can't be propery void register(uint reg1, uint reg2, uint reg3); void register(uint[] register ...); //maybe? void register(Register register); //getter ?? Register register() const; Or perhaps... struct S { mixin(bitfields!( uint, "opcode", 4, uint, "reg1", 4, uint, "reg2", 4, uint, "reg3", 4 )); mixin(sharedNameSet( "nameForGetterAndSetter", "struct name for returning/passing", "reg1", "reg2", "reg3" //named variables as a set )); //nameForGetterAndSetter's would be added here, perhaps as above. } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 31 2012
http://d.puremagic.com/issues/show_bug.cgi?id=4937 PST --- I think we're good as we are. OK to close? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 26 2013