[lkml]   [1998]   [Jul]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: How to get aligned memory?
    On Thu, 30 Jul 1998, Inaky Perez Gonzalez wrote:

    > Hi
    > 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 :).
    This can be done in one line, with one pointer, but I will do it

    funny struct *bits;
    char *foo, *bar;
    foo = (char *) malloc(WHATEVER); /* Waste 16 bits */
    bar = foo;
    foo += 0x00000010;
    foo &= 0xfffffff0;
    bits = (funny struct *) foo;
    do stuff

    Dick Johnson
    ***** FILE SYSTEM MODIFIED *****
    Penguin : Linux version 2.1.111 on an i586 machine (66.15 BogoMips).
    Warning : It's hard to remain at the trailing edge of technology.

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    Please read the FAQ at

     \ /
      Last update: 2005-03-22 13:43    [W:0.018 / U:5.564 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site