|
Boost : |
Subject: Re: [boost] Interest request for pointer+bit compressionoptimization
From: Edouard A. (edouard_at_[hidden])
Date: 2009-09-07 16:42:50
> You actually have more than one bit available as the OS generally reserves
a
> huge area of virtual memory for the kernel. Typical example, Windows 32,
> maximum user pointer value is 0x80000000. Don't remember the values by
heart
> for the other oses.
>>The trick is not because the OS don't use the whole addresable memory but
on the fact >memory is aligned.
>>From the blog
>"Alignment considerations dictate that many types must lie in memory
addresses that are >multiple of some small integer greater than 1; in
particular, it is extremely usual that >the alignment of a type T is even
(i.e. a multiple of 2), in which case the least >significant bit of the
representation of pointers to T is always zero. And this is >precisely the
situation in which we can reuse this bit to embed the color information:"
I know, that doesn't mean it cannot be pushed further. 1 bit is not much.
You can even go beyond that and use your own memory allocator that's going
to make sure the pointer have space where you expect it to bit. Let's say
you can salvage 4 bit on the low part and 4 on the high part (for 32 bit
pointers), that's 8 bit ! :)
-- EA __________ Information from ESET NOD32 Antivirus, version of virus signature database 4403 (20090907) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk