Re: [Evolution-hackers] Moving the struct instance heap space to mmap

Philip Van Hoof <[email protected]>
Newsgroups gmane.comp.gnome.performance,gmane.comp.gnome.evolution.devel
Message-ID <[email protected]>
On Thu, 2006-09-07 at 21:14 +0200, Philip Van Hoof wrote:

> To read message n, you would simply do something like:
> 
> from = sstart + *(istart + (sizeof (int) * 4 * n) + 1)
> subject = sstart + *(istart + (sizeof (int) * 4 * n) + 2)
> to = sstart + *(istart + (sizeof (int) * 4 * n) + 3)
> flags = sstart + *(istart + (sizeof (int) * 4 * n) + 4)
> 

No no no no no. I meant (something like) this of course:


unsigned char *sstart = (uchar*)mmap(..), *istart = (uchar*)mmap(..);
#define AMOUNT_OF_OFFSETS_PER_RECORD 4
#define AOO AMOUNT_OF_OFFSETS_PER_RECORD

from = sstart + *(istart + ((sizeof (uint32_t) * AOO * n) + sizeof (uint32_t)))
subject = sstart + *(istart + ((sizeof (uint32_t) * AOO * n) + sizeof (uint32_t)))
to = sstart + *(istart + ((sizeof (uint32_t) * AOO * n) + sizeof (uint32_t)))
flags = sstart + *(istart + ((sizeof (uint32_t) * AOO * n) + sizeof (uint32_t)))

To much pointers in my head ;)

-- 
Philip Van Hoof, software developer at x-tend 
home: me at pvanhoof dot be 
gnome: pvanhoof at gnome dot org 
work: vanhoof at x-tend dot be 
http://www.pvanhoof.be - http://www.x-tend.be
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.