libtt/drummachine: Fix signed division bug
authorDaniel Thompson <daniel@redfelineninja.org.uk>
Sun, 6 Jan 2013 13:20:54 +0000 (13:20 +0000)
committerDaniel Thompson <daniel@redfelineninja.org.uk>
Sun, 6 Jan 2013 13:20:54 +0000 (13:20 +0000)
commitab0011aa709a9005ab6b107c9d797a8ae7c1f5cc
treeb3b0090b072ef6d80f7dd405325cbee7382a13cc
parent53fead807408b9580281ccf2db4b36836349ce87
libtt/drummachine: Fix signed division bug

TT_DRUMMACHINE_VOICE_LENGTH is used in division expressions on signed
numbers. It must therefore be signed to ensure these expressions don't
perform unsigned division (thus not propagating the sign bit).

Curiously this bug cannot be observed on 64-bit systems where the
expression converts to 64-bit unsigned division and a later downcast to
32-bit restores the sign bit!

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
src/libtt/drummachine.c