From 7d187fe92c6a50fd9701c11d7f0660a71e8716af Mon Sep 17 00:00:00 2001 From: uz Date: Tue, 27 Dec 2011 22:36:28 +0000 Subject: [PATCH] Export MAX_ALIGNMENT. git-svn-id: svn://svn.cc65.org/cc65/trunk@5330 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/common/alignment.c | 3 +-- src/common/alignment.h | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/common/alignment.c b/src/common/alignment.c index ff5d11261..9dad01d3e 100644 --- a/src/common/alignment.c +++ b/src/common/alignment.c @@ -59,7 +59,6 @@ static const unsigned char Primes[] = { }; #define PRIME_COUNT (sizeof (Primes) / sizeof (Primes[0])) #define LAST_PRIME ((unsigned long)Primes[PRIME_COUNT-1]) -#define FAC_MAX 0x10000UL @@ -107,7 +106,7 @@ static void Factorize (unsigned long Value, FactorizedNumber* F) } /* Be sure we can factorize */ - CHECK (Value <= FAC_MAX && Value != 0); + CHECK (Value <= MAX_ALIGNMENT && Value != 0); /* Handle factor 2 separately for speed */ while ((Value & 0x01UL) == 0UL) { diff --git a/src/common/alignment.h b/src/common/alignment.h index a8d4c384d..84ed7c20b 100644 --- a/src/common/alignment.h +++ b/src/common/alignment.h @@ -43,6 +43,19 @@ +/*****************************************************************************/ +/* Data */ +/*****************************************************************************/ + + + +/* Maximum possible alignment. Beware: To increase the possible alignment it + * is not enough to bump this value. Check the code inside. + */ +#define MAX_ALIGNMENT 0x10000UL + + + /*****************************************************************************/ /* Code */ /*****************************************************************************/ @@ -55,7 +68,7 @@ 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 */ -- 2.39.5