Måns Rullgård <[email protected]> wrote:
> Eric Wong <[email protected]> writes:
> > dnl Checks for library functions.
> > -AC_CHECK_FUNCS(strcasecmp strdup popen vsnprintf gettimeofday mkstemp
> > fmemopen aligned_alloc)
> > +AC_CHECK_FUNCS(strcasecmp strdup popen vsnprintf gettimeofday mkstemp
> > fmemopen)
> > +
> > +dnl aligned alloc required for sdm using AVX (32-byte) or SSE2 (16-byte)
> > +AC_CHECK_FUNCS(aligned_alloc)
> > +AS_IF([test "x$ac_cv_func_aligned_alloc" != xyes], [
> > + AC_CHECK_FUNCS([memalign])
> > + AS_IF([test "x$ac_cv_func_memalign" != xyes], [
> > + AC_CHECK_FUNCS([posix_memalign])
> > + ])
> > +])
>
> Why don't you just add (posix_)memalign to the existing list of
> functions? It's not an error if some of them don't exist, and you're
> checking the resulting HAVE_ macros in the same order anyway.
I wanted to avoid the overhead of checking redundantly if one
function was already available; but perhaps it's not worth the effort
since `configure' is already slow in other places.
> > +static inline void *sox_aligned_alloc_m(size_t align, size_t size)
> > +{
> > + void *res = malloc(align + size + sizeof(void *));
> > + char *aligned = (char *)res + align + sizeof(void *);
> > +
> > + aligned -= ((size_t)aligned & (align - 1));
>
> Use uintptr_t rather than size_t there. Although they are usually the
> same underlying type, there is no such guarantee, especially for systems
> bizarre enough not to have an aligned allocation function.
I wanted to, but I figure systems missing *memalign could also
be missing uintptr_t and stdint.h
Perhaps "unsigned long" is better?
------------------------------------------------------------------------------
_______________________________________________
SoX-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sox-devel