sox-devel@lists.sourceforge.net unofficial mirror
 help / color / mirror / code / Atom feed
From: Eric Wong <normalperson@yhbt.net>
To: "Måns Rullgård" <mans@mansr.com>
Cc: sox-devel@lists.sourceforge.net
Subject: Re: [PATCH 4/6] Add macros for increasing data alignment
Date: Mon, 21 Dec 2015 18:33:49 +0000	[thread overview]
Message-ID: <20151221183349.GA13430@dcvr.yhbt.net> (raw)
In-Reply-To: <yw1x1tag6ni1.fsf@unicorn.mansr.com>

Måns Rullgård <mans@mansr.com> wrote:
> Eric Wong <normalperson@yhbt.net> 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
SoX-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-devel

  reply	other threads:[~2015-12-21 18:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-16 14:16 [PATCH 1/6] Add SOX_ENCODING_DSD Mans Rullgard
2015-09-16 14:16 ` [PATCH 2/6] Add DSF file support Mans Rullgard
2015-09-16 14:16 ` [PATCH 3/6] Add support for reading DSDIFF files Mans Rullgard
2015-09-16 14:16 ` [PATCH 4/6] Add macros for increasing data alignment Mans Rullgard
2015-12-20 12:41   ` Eric Wong
2015-12-20 13:54     ` Måns Rullgård
2015-12-21 10:55       ` Eric Wong
2015-12-21 11:37         ` Måns Rullgård
2015-12-21 18:33           ` Eric Wong [this message]
2015-12-21 18:37             ` Måns Rullgård
2015-09-16 14:16 ` [PATCH 5/6] Add a sigma-delta modulator for DSD encoding Mans Rullgard
2015-10-03 22:31   ` Eric Wong
2015-10-03 22:39     ` Måns Rullgård
2015-09-16 14:16 ` [PATCH 6/6] Add DSD over PCM (dop) effect Mans Rullgard
2015-12-19 12:09   ` Eric Wong
2015-12-19 12:14     ` Måns Rullgård
2015-12-20  5:04       ` Eric Wong
2015-12-20 13:44         ` Måns Rullgård

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.sourceforge.net/lists/listinfo/sox-devel

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151221183349.GA13430@dcvr.yhbt.net \
    --to=sox-devel@lists.sourceforge.net \
    --cc=mans@mansr.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/sox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).