Re: Compile-Time Size Checking of Enum Members of std.bitmanip.bitfields

2015-01-19 Thread via Digitalmars-d-learn
On Monday, 19 January 2015 at 11:49:29 UTC, Per Nordlöw wrote: What's the name of `bitsNeeded` (binary Power) in Phobos? core.bitop.bsr For details see: http://forum.dlang.org/thread/okonqhnxzqlqtxijx...@forum.dlang.org#post-kscrsodwmslgveptrxmx:40forum.dlang.org

Re: Compile-Time Size Checking of Enum Members of std.bitmanip.bitfields

2015-01-19 Thread via Digitalmars-d-learn
On Monday, 19 January 2015 at 11:40:07 UTC, Per Nordlöw wrote: Typical deductions are - enums: E.max - E.min + 1 (this requires offsetting logic in I guess a trait for this, say enum bitsizeOf(E) = return bitsNeeded(E.max - E.min + 1); is motivated aswell, if it doesn't already exists... Wha

Re: Compile-Time Size Checking of Enum Members of std.bitmanip.bitfields

2015-01-19 Thread via Digitalmars-d-learn
On Monday, 19 January 2015 at 11:23:11 UTC, bearophile wrote: File an enhancement and/or submit a Phobos patch. Ok, great. I'll try fixing this in a PR. Further...I propose to enhance `bitfields` to automatically deduce bitfield lengths in the following way. autoBitfields!(ubyte, "x", 3,

Re: Compile-Time Size Checking of Enum Members of std.bitmanip.bitfields

2015-01-19 Thread bearophile via Digitalmars-d-learn
Nordlöw: wouldn't it be better to detect the mismatches between enum bit-sizes and bitfield lengths at compile-time instead of at run-time? File an enhancement and/or submit a Phobos patch. Bye, bearophile