This is the mail archive of the rda@sources.redhat.com mailing list for the rda project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] rda/samples: improve memory allocation


Michael Snyder writes:

  + #define ALLOC_UNIT  0x1000;

    Oops, extra semicolon!

  + #define alloc_roundup(LEN) ((LEN / ALLOC_UNIT) + ALLOC_UNIT)

    This looks like it's missing a multiplication again by ALLOC_UNIT.
    Say, if LEN is 0x3000, then alloc_roundup(LEN) comes out to 0x1003
    which seems weird.

Perhaps:

#define alloc_roundup(LEN) ((((LEN)+ALLOC_UNIT-1) / ALLOC_UNIT) * ALLOC_UNIT)

Or I dunno exactly what you want, but that definition doesn't look
right.  Looks like a missing call to alloc_coffee somewhere ...

Michael C


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]