[maemo-developers] [maemo-developers] Re: Tinymail using mmap() gets killed by the kernel of the device

From: Tomi Ollila tomi.ollila at guru.guru-group.fi
Date: Sun Jul 16 14:52:41 EEST 2006
Philip Van Hoof <spam at pvanhoof.be> writes:

> On Sat, 2006-07-15 at 23:19 +0300, Tomi Ollila wrote:
>> Philip Van Hoof <spam at pvanhoof.be> writes:
>> 
>> >
>> > If somebody feels brave, feel free to assist me in getting it 4 byte
>> > aligned ;-). I don't have a lot experience here.
>> 
>> (((char *)address + 3) & ~3)
>
> I simply use this on each char* pointer? That's it?

Something like it... you just have to ensure there is enough space at the
end (i.e aligning requires that there is 1-3 bytes more space for the data).

Also, maybe better (or worse!) is (char *)(((int)address + 3) & ~3),
assumed that sizeof (char *) == sizeof (int).

This latter version seems to compile...

... this too: (char *)((int)((char *)address + 3) & ~3));, but that is not
any better (in sizeof comparisons...).

> Philip Van Hoof, software developer at x-tend 

Tomi

More information about the maemo-developers mailing list