Subject: Re: unaligned access: how to track ?
To: Chris G. Demetriou <>
From: Manuel Bouyer <>
List: port-alpha
Date: 06/08/2000 18:18:41
On Wed, Jun 07, 2000 at 10:07:12AM -0700, Chris G. Demetriou wrote:
> uh...
> As far as the 'db' API is concerned, it can return keys/data at random
> offsets, completely disregarding the alignment of anything you supply.
> No amount of padding you do on the input side will help that (because
> who knows what it's packing them _against_, for all you know it's got
> some internal structures that it uses which really are byte
> strings... at least, it's allowed to).
> The only solution is to copy the data after lookup, before accessing
> them, if they're not aligned.  You can use ALIGN to help you check
> this (but that's not portable code, if you care), or you can do the
> conservative thing and always copy.

Ok, it seems in this case the best thing to do is to always copy. From tests
I ran it looks like there's no gain in trying to align the data on write
and test on read.

Thanks !

Manuel Bouyer, LIP6, Universite Paris VI.