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



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




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]