Mail Archives: djgpp/1996/06/06/00:39:58
Reply to message 1939282 from KAGEL AT DG1 DOT BLO on 06/05/96 9:15AM
>MYTYPE *aligned, *unaligned; /* Or some reasonable typedef. */
>
>aligned = (MYTYPE *)((unsigned)un_aligned
> +(unsigned)alignment /*Advance pointer alignment */
>/*Backup by #misaligned bytes*/ -((unsigned)un_aligned %
(unsigned)alignment));
>
>You want to advance the pointer to the next higher aligned address. This
>simple code, as suggested by John Aldrich with correction, is clearer than the
>'&~' code M. Latorre came up with and the optimizer should do a good job at
>making it efficient.
Ah, I see what my mistake was. Thanks for the correction. :)
John
- Raw text -