Fix a division bug on 64-bit platforms.

The GCC builtin clzl depends on the sizeof(long), which
caused an error if it was other than 32 bits.

Fixes issue #17.
This commit is contained in:
Petteri.Aimonen 2012-08-31 10:16:09 +00:00
parent 10af3a6c60
commit a3ad27ed10
1 changed files with 1 additions and 1 deletions

View File

@ -275,7 +275,7 @@ fix16_t fix16_smul(fix16_t inArg0, fix16_t inArg1)
#if !defined(FIXMATH_OPTIMIZE_8BIT)
#ifdef __GNUC__
// Count leading zeros, using processor-specific instruction if available.
#define clz(x) __builtin_clzl(x)
#define clz(x) (__builtin_clzl(x) - (8 * sizeof(long) - 32))
#else
static uint8_t clz(uint32_t x)
{