[Issue 12027] Range of true bits for std.bitmanip.BitArray

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Mar 1 13:47:53 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=12027



--- Comment #5 from Peter Alexander <peter.alexander.au at gmail.com> 2014-03-01 13:47:50 PST ---
(In reply to comment #4)
> (In reply to comment #3)
> 
> > Also adds:
> > - countTrailingZeros(v)
> > - countBitsSet(v)
> > - bitsSet(v)
> 
> Apparently only bitsSet is working for me:

countTrailingZeros and countBitsSet are only defined for built-in integral
types at the moment. They were needed to implement bitsSet. However, I was
persuaded to make them private because druntime defines popcnt and bsf, but not
generically. @blackwhale argued that popcnt/bsf should be extended to be more
generic in druntime, but I argued that druntime was for things only necessary
for the D language to work, and these weren't necessary. We disagreed, so
compromised and just marked them as private for now until we figure out how to
resolve it.

btw, bitsSet also works on built-in integers, e.g. 5.bitsSet.equal([0, 2]);

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list