Why must butfields sum to a multiple of a byte?
Andrej Mitrovic
andrej.mitrovich at gmail.com
Mon Jul 30 10:15:44 PDT 2012
On 7/30/12, Ali Çehreli <acehreli at yahoo.com> wrote:
> The program should be able to detect the placements of the fields. You
> can expect a certain bit pattern for a given set of values of the bit
> fields, set those values, read them on the D side, detect potential
> inconsistencies, and fail the execution (or hopefully compilation).
Yeah that was exactly my thinking, these things can be automated
although they might slow down the whole codegeneration process a
little bit (not that it matters much since you would rarely have to
regenerate).
Btw, I get an internal std error with this mixin:
import std.bitmanip;
struct Foo
{
mixin(bitfields!(
uint, "bits1", 32,
));
}
D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\bitmanip.d(76): Error:
shift by 32 is outside the range 0..31
Should I file this?
More information about the Digitalmars-d-learn
mailing list