[clug] Looking for Linux on CBE programming expert help

Paul Wayper paulway at mabula.net
Tue Sep 1 16:38:16 MDT 2009


On 30/08/09 03:40, David Tulloh wrote:
> This can be written without the loop as
>
> (char*) p1 += (memory_t) p1 % 128;

Forgive me, because most of the time I don't have to deal with memory 
alignment at all, but wouldn't this add the offset rather than the difference? 
  I.e. don't you need:

(char*) p1 += 128 - (memory_t) p1 % 128;

E.g. if the offset is 3, then you'd add (128-3) to get to a 128-byte boundary.

Have fun,

Paul


More information about the linux mailing list