Force a numeric value to be in a specified range
Only defined for simple integers (ValueClass LONG)
WARNING: unsigned values are forced into the
signed size, but the proper bit pattern is maintained.
Given a set of ranges, {0..1,0..1,0..2}, say,
generate all possible lists of values
0,0,0
0,0,1
0,0,2
0,1,0
0,1,1
0,1,2
1,0,0
1,0,1
1,0,2
1,1,0
1,1,1
1,1,2
The ranges are all assumed to run from 0 upto but not including some max,
so above would be generated from {2,2,3}.