fixing float behaviour and organising the code to fix the weird list behaviour
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
-/* CHECKED:
- bang for a float at > (refman error: >=)
- bang for a list if all >= (refman page says the same)
- bang for a list if any is >, even if the rest (but not previous) is <
- well...
-*/
+/* porres 2017, fixing list weirdness behaviour cause it has no practical purpose and basically
+ ruins the whole purpose of comparing lists...
+ we shouldn't replicate max bugs if they ruin the object */
#include "m_pd.h"
#include "common/loud.h"
#include "common/grow.h"
#include "common/fitter.h"
-#define PAST_C74MAXSIZE 8 /* CHECKED */
+#define PAST_C74MAXSIZE 8 // RECHECK
typedef struct past
{
@@ -32,21 +29,15 @@ static int past_compare(t_past *x, t_float f, t_atom *ap)
{
if (ap->a_type == A_FLOAT)
{
- if (f > ap->a_w.w_float)
- return (1);
- else if (f == ap->a_w.w_float)
- return (0);
- else
- return (-1);
+ if (f > ap->a_w.w_float) return (1);
+ else if (f == ap->a_w.w_float) return (0);
+ else return (-1);
}
else /* CHECKED */
{
- if (f > 0.)
- return (1);
- else if (f == 0.)
- return (0);
- else
- return (-1);
+ if (f > 0.) return (1);
+ else if (f == 0.) return (0);
+ else return (-1);
}
}
@@ -54,7 +45,7 @@ static void past_float(t_past *x, t_float f)
{
if (x->x_nthresh == 1)
{
- if (past_compare(x, f, x->x_thresh) > 0) /* CHECKED: equal is low */
+ if (past_compare(x, f, x->x_thresh) >= 0)
{
if (x->x_low)
{
@@ -67,7 +58,7 @@ static void past_float(t_past *x, t_float f)
else if (past_compare(x, f, x->x_thresh) < 0) x->x_low = 1;
}
-/* CHECKME: x_low handling */
+
static void past_list(t_past *x, t_symbol *s, int ac, t_atom *av)
{
if (ac && ac <= x->x_nthresh)
@@ -82,8 +73,7 @@ static void past_list(t_past *x, t_symbol *s, int ac, t_atom *av)
for (ac--, av++, vp++; ac; ac--, av++, vp++)
{
if (av->a_type != A_FLOAT
- || (result =
- past_compare(x, av->a_w.w_float, vp++)) < 0)
+ || (result = past_compare(x, av->a_w.w_float, vp++)) < 0)
{
x->x_low = 1;
return;
