Re: Data alignment code... What goes on?



dk_sz wrote:
So why not simply

#define ALIGN4(len) (4)
#define ALIGN8(len) (8)

Because ALIGN4(5) gives 8, ALIGN4(12) gives 16, ALIGN16(17) gives 32 and so
on. The macros *don't* align, they pad the size of the requested allocation
up to a multiple of the number in their name.

--
Anders Isaksson, Sweden
BlockCAD: http://web.telia.com/~u16122508/proglego.htm
Gallery: http://web.telia.com/~u16122508/gallery/index.htm


.



Relevant Pages

  • Re: Writing single bits to a file
    ... Then stuff the three leftover bits into a third byte, pad that byte with ... but it's not just a matter of saving space. ... even if the physical size on disk is a multiple ...
    (comp.lang.c)
  • Re: Using CAPI to encrypt in AES CBC mode without padding
    ... multiple of 16 but if the input buffer is multiple of 16, ... I'm wondering if CAPI wants padding all the time. ... If you are not a multiple of 16 bytes, it will pad to 16 ...
    (sci.crypt)