Can someone check this for me please?
I believe the first & (AND) operator every line of packDimInfo() should be replaced by the ! (OR) operator. For example:
i = (i & ((int)(slice)&3)) << 2;
^
replace this
with
i = (i | ((int)(slice)&3)) << 2;
Otherwise the return value will always be 0.
The final results should be as below.
static public byte
packDimInfo(short freq, short phase, short slice) {
int i = 0;
i = (i | ((int)(slice)&3)) << 2;
i = (i | ((int)(phase)&3)) << 2;
i = (i | ((int)(freq)&3));
return ((byte)i);
}