summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJukka Ojanen <jukka.ojanen@linkotec.net>2015-07-02 16:52:05 +0300
committerJukka Ojanen <jukka.ojanen@linkotec.net>2015-07-02 16:52:05 +0300
commit502acf15c749a6d32680a5843da79934f2d985d4 (patch)
tree2cc57ce6e77bcc46522a75762bf3bc6fa2da2e5e
parentdfab21f8096660f441fb33bf5012e7f2c3652fa9 (diff)
downloadffts-502acf15c749a6d32680a5843da79934f2d985d4.zip
ffts-502acf15c749a6d32680a5843da79934f2d985d4.tar.gz
Fix assertion failed in ffts_compare_offsets
-rw-r--r--src/patterns.c9
1 files 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)
OpenPOWER on IntegriCloud