Bug 11160 – Bitfield compilation error with degenerate bitfields of length 32 & 64

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-10-02T16:42:00Z
Last change time
2013-10-05T08:18:03Z
Keywords
patch, pull
Assigned to
nobody
Creator
safety0ff.bugz

Attachments

IDFilenameSummaryContent-TypeSize
12560001-Support-degenerate-bitfields.patchProposed fixtext/plain3256

Comments

Comment #0 by safety0ff.bugz — 2013-10-02T16:42:58Z
According to the documentation the only constraint on bitfields is: "The sum of all bit lengths in one bitfield instantiation must be exactly 8, 16, 32, or 64." The current implementation support degenerate bitfields with field lengths 8 and 16. For example: mixin(bitfields!(uint, "x", 8, int, "y", 8)); mixin(bitfields!(uint, "x", 8, int, "y", 8, int, "z", 16)); But not with 32 and 64 as length.
Comment #1 by safety0ff.bugz — 2013-10-02T16:44:12Z
Created attachment 1256 Proposed fix Note: I could not use integer exponentiation with overflow due to #11159, so I used ~0 with shifts.
Comment #2 by andrej.mitrovich — 2013-10-02T19:06:06Z
Dupe of Issue 8474?
Comment #3 by safety0ff.bugz — 2013-10-02T20:00:53Z
(In reply to comment #2) > Dupe of Issue 8474? This issue is a dupe of 8474, but the code in 8474 includes all kinds of enhancements squashed into a non-atomic commit. The author never created a pull request despite referring to one in the 4 issues mentioned below. In this case, which one should be marked duplicate? Looking at bunch of linked bitmanip bugs referenced in the commit message for the code in issue 8474: Issue 6686 is a dupe of issue 5942, but both should be resolved as worksforme with current std.bitmanip. Issue 4935 also worksforme.
Comment #4 by safety0ff.bugz — 2013-10-02T20:29:48Z
(In reply to comment #3) > The author never created a pull request despite referring to one in the 4 > issues mentioned below. Actually found the pull requests using google (PR 1045, 719, 734,740.) All closed but don't appear merged. Anyways, using DPaste 6686/ 5942 were fixed between 2.060 and 2.063. 4935 was fixed prior to 2.060.
Comment #5 by safety0ff.bugz — 2013-10-03T07:50:40Z
Comment #6 by code — 2013-10-05T08:18:03Z