From 502acf15c749a6d32680a5843da79934f2d985d4 Mon Sep 17 00:00:00 2001 From: Jukka Ojanen Date: Thu, 2 Jul 2015 16:52:05 +0300 Subject: Fix assertion failed in ffts_compare_offsets --- src/patterns.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/patterns.c b/src/patterns.c index 17133d1..04bdccb 100644 --- a/src/patterns.c +++ b/src/patterns.c @@ -159,11 +159,12 @@ static void ffts_elaborate_offsets(ptrdiff_t *offsets, int leafN, int N, int iof } } -static int ffts_compare_offsets(const void *a, const void *b) +static int +ffts_compare_offsets(const void *pa, const void *pb) { - ptrdiff_t diff = ((ptrdiff_t*) a)[0] - ((ptrdiff_t*) b)[0]; - assert(diff > INT_MIN && diff < INT_MAX); - return (int) diff; + const ptrdiff_t a = *(const ptrdiff_t*) pa; + const ptrdiff_t b = *(const ptrdiff_t*) pb; + return (a > b) - (a < b); } ptrdiff_t *ffts_init_offsets(size_t N, size_t leaf_N) -- cgit v1.1