Skip to content

Fix switch op

Sebastien Wertz requested to merge swertz/bamboo:fixSwitch into master

Because the ternary operator has a lower precedence than arithmetic operations, doing something like:

z = x + op.switch(y > 5, 0, 1)

would result in

z = x + y > 5 ? 0 : 1;

which is equivalent to

z = (x + y) > 5 ? 0 : 1;

and not the desired

z = x + (y > 5 ? 0 : 1);

This fixes it by adding these extra parentheses.

I've also added two helper functions to compute delta phi angles based on angles and not on 4-vectors directly.

Merge request reports