From 5375bda6ac9a155173f007f4c8cd0276270acca1 Mon Sep 17 00:00:00 2001 From: Tres Finocchiaro Date: Sat, 15 Aug 2015 13:23:32 -0400 Subject: [PATCH] Fix incorrect calculation of IntBits Fix over-shifting of int by explicitly making type ULL. Taken from upstream: https://github.com/calf-studio-gear/calf/commit/aaca6447de6ed07bb39f376095bb246cc8f3580a --- plugins/LadspaEffect/calf/src/calf/fixed_point.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/LadspaEffect/calf/src/calf/fixed_point.h b/plugins/LadspaEffect/calf/src/calf/fixed_point.h index 44e767e4b..8803cd179 100644 --- a/plugins/LadspaEffect/calf/src/calf/fixed_point.h +++ b/plugins/LadspaEffect/calf/src/calf/fixed_point.h @@ -37,7 +37,7 @@ inline T shr(T v, int bits = 1) { template class fixed_point { T value; - enum { IntBits = (sizeof(T)/8) - FracBits }; + enum { IntBits = (sizeof(T)*8) - FracBits }; public: /// default constructor, does not initialize the value, just like - say - float doesn't @@ -210,13 +210,13 @@ public: template inline U lerp_by_fract_int(U v1, U v2) const { int fp = fpart(); - assert ( fp >=0 && fp <= (1<=0 && fp <= (1ULL< - inline U lerp_table_lookup_int(U data[(unsigned int)(1<(data[pos], data[pos+1]); } @@ -224,19 +224,19 @@ public: /// Untested... I've started it to get a sin/cos readout for rotaryorgan, but decided to use table-less solution instead /// Do not assume it works, because it most probably doesn't template - inline U lerp_table_lookup_int_shift(U data[(unsigned int)(1<(data[pos], data[pos+1]); } template - inline U lerp_table_lookup_float(U data[(unsigned int)(1< - inline U lerp_table_lookup_float_mask(U data[(unsigned int)(1<