BitArray - Is there one?

Dmitry Olshansky dmitry.olsh at gmail.com
Mon May 28 23:56:37 PDT 2012


On 29.05.2012 10:52, Era Scarecrow wrote:
> On Tuesday, 29 May 2012 at 06:30:37 UTC, Dmitry Olshansky wrote:
>> You surely haven't looked at the source code did you? :)
>> It's conceptualy non per bit '-', it's a set difference...
>
> I recall looking at it, but to me that just didn't make sense. I could
> add subtract back and update it (Not many changes needed to keep it).
>
>> Not at all. Once you established that it's not a pointer namely since
>> every pointer to size_t is word aligned (unless constructed by hand).
>
>> You could use it's lowest bit as marker then. It's 0 state won't
>> disturb pointer usual semantics, when it's set to 1 it's obviously.
>
> I considered that, but then you actually limit your address space to
> 2^63,

No you don't. Since pointer is already a pointer to word-sized object. 
It has 2 last bits == 0. Always. There is no escaping of this fact. And 
no your address space is intact. All it has to do is assuming proper 
alignment, and you sure have it since you _allocate_ it.
To be more specific most allocator go even farther and provide 8bytes 
aligned pointer.

true that seems silly up until in the future when we use all
> 64bits for memory referencing and suddenly it's seg faulting for no
> understandable reason (Yes it's a long ways off, but this will long be
> forgotten about by that time). However referring to the internal offsets
> it only effects slices; and those are easy to fix.
>
See the above.

> This will likely take a little time to think over and get working, I'd
> hate to have to make alternate versions of everything.
>


>> Cool. Eager to see that on the way to Phobos too.
>
> We'll see, once I sorta figure this all out.


-- 
Dmitry Olshansky


More information about the Digitalmars-d-learn mailing list