Mill Computing, Inc. › Forums › The Mill › Architecture › switches › Reply To: switches
I thought of a better way. The mill supports vector reducing operations like all and any. I don’t know the syntax for them, but perhaps the between operation could take a number and a vector and tell you if the number is in that range. for example:
F("bar") %0;
con (v(4ul, 7ul)) %1, // whatever syntax to build a vector
betw (b1 %0, b0 %1) %2; // true if 4 <= x && x <= 7
Since the value is a vector, it can use only one functional unit to calculate if x is within the range. That would make switches ranges trivial to optimize.