Not sure I completely understand what you are after, but I think most audio 
folks don't use types like int, long and short, but rather types like int32_t 
from types.h (or sys/types.h). There are various guarantees made about the 
sizes of those types that you can look up.

Also, I assume you've given C++ templates and operator overloading 
consideration.

        bjorn


On May 1, 2013, at 4:35 PM, Sampo Syreeni wrote:

> For the longest time I took out a compiler and started cranking out an old 
> idea. In that vein, I'm using libsndfile and its (highly reasonable) 
> processing model: you just keep everything to zero padded ints (preferably 
> signed) and go from there.
> 
> The trouble is that my code is of the kind that also requires lots of bit 
> twiddling. My current problem comes from trying to make the code more or less 
> adaptive to any bit width, while I also have to do stuff like computed shifts.
> 
> So, how do you go about systematically and portably implementing what you 
> would expect from your logical operations, using standard C operations, 
> without knowing the basic width of your types? (Logical, not arithmetic) 
> right shifts of signed quantities, efficient parity, and computed shifts with 
> negative offsets are proving particularly nasty at the moment. (It has to do 
> with dithering at arbitrary word length which also has to be reasonably 
> efficient if any set in silicon.)
> -- 
> Sampo Syreeni, aka decoy - de...@iki.fi, http://decoy.iki.fi/front
> +358-50-5756111, 025E D175 ABE5 027C 9494 EEB0 E090 8BA9 0509 85C2
> --
> dupswapdrop -- the music-dsp mailing list and website:
> subscription info, FAQ, source code archive, list archive, book reviews, dsp 
> links
> http://music.columbia.edu/cmc/music-dsp
> http://music.columbia.edu/mailman/listinfo/music-dsp

-----------------------------
Bjorn Roche
http://www.xonami.com
Audio Collaboration
http://blog.bjornroche.com
@xonamiaudio

--
dupswapdrop -- the music-dsp mailing list and website:
subscription info, FAQ, source code archive, list archive, book reviews, dsp 
links
http://music.columbia.edu/cmc/music-dsp
http://music.columbia.edu/mailman/listinfo/music-dsp

Reply via email to