From: uz Date: Tue, 27 Dec 2011 22:31:36 +0000 (+0000) Subject: New function AlignCount. X-Git-Tag: V2.13.3~135 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d0555c400ebcc56af4dcf8b8dd594b5d7ae5ee3b;p=cc65 New function AlignCount. git-svn-id: svn://svn.cc65.org/cc65/trunk@5329 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/src/common/alignment.c b/src/common/alignment.c index 593926db5..ff5d11261 100644 --- a/src/common/alignment.c +++ b/src/common/alignment.c @@ -178,3 +178,11 @@ unsigned long AlignAddr (unsigned long Addr, unsigned long Alignment) +unsigned long AlignCount (unsigned long Addr, unsigned long Alignment) +/* Calculate how many bytes must be inserted to align Addr to Alignment */ +{ + return AlignAddr (Addr, Alignment) - Addr; +} + + + diff --git a/src/common/alignment.h b/src/common/alignment.h index 15f44a368..a8d4c384d 100644 --- a/src/common/alignment.h +++ b/src/common/alignment.h @@ -55,7 +55,10 @@ unsigned long LeastCommonMultiple (unsigned long Left, unsigned long Right); */ unsigned long AlignAddr (unsigned long Addr, unsigned long Alignment); -/* Align an address to the given alignment */ +/* Align an address to the given alignment */ + +unsigned long AlignCount (unsigned long Addr, unsigned long Alignment); +/* Calculate how many bytes must be inserted to align Addr to Alignment */