Re: [linux-usb] How to get aligned memory?

Nick Hibma (nick.hibma@jrc.it)
Fri, 31 Jul 1998 10:15:21 +0200 (MET DST)


> This is a so silly question I feel dumb for not having able to
> find it myself ... how can I get aligned memory?
>
> The problem is I have this structure, 64 bits long which needs
> to be aligned to 16 bytes (thx, Intel >:), but I cannot find my to do
> it (except to allocate a lot until I get it aligned, which is quite
> wasteful :).
Have a look at the malloc man page. I think it tells you that a block of
n bytes (n a power of two) is aligned to the nearest higher power of
two, guarantueed. At least that is the way the Framelist is aligned in
my code. I do check that in debugging mode but it has not failed up to
now.

Nick

-- 
building: 27A
address:  STA-ISIS, T.P.270, Joint Research Centre, 21020 Ispra, Italy
tel.:     +39 332 78 9549
fax.:     +39 332 78 9185

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html