With (val>>1)-(val & 1)
you get your first result:
0 -> 0
1 -> -1
2 -> 1
The alternative result can be got with (val & 1)-(val>>1)
:
0 -> 0
1 -> 1
2 -> -1
0
solved Formula for Mapping three values [closed]
With (val>>1)-(val & 1)
you get your first result:
0 -> 0
1 -> -1
2 -> 1
The alternative result can be got with (val & 1)-(val>>1)
:
0 -> 0
1 -> 1
2 -> -1
0
solved Formula for Mapping three values [closed]