Since this is more of a programming question, I'm going to use "C notation" for the hex values.
Combining 2 bytes to get a 16-bit integer:
theInteger = (upperByte << 8) + lowerByte;
For example,
upperByte = 0xfc lowerByte = 0x92 theInteger = (upperByte << 8) + lowerByte = (0xfc << 8) + lowerByte = ( 0xfc00 ) + 0x92 = 0xfc92
dissecting a 16-bit integer into two bytes:
upperByte = theInteger >> 8; lowerByte = theInteger & 0xff;
For example,
theInteger = 0xfc92 upperByte = theInteger >> 8 = 0xfc92 >> 8 = 0xfc lowerByte = theInteger & 0xff = 0xfc92 & 0xff = 0x92.
formula
I suspect the "& 7f" in that formula should be something more like "& ff". If it were really "& ff", then reversing the formula is easy -- subtract one from the integer, and then dissect the integer into two bytes.
However, if the "& 7f" is correct, then it's a little more complicated -- no matter what initial byte values we have, that formula (with the "& 7f") will never generate certain integers. In particular, it will never generate the integer 0x8000. Also, there are two different byte pairs that that formula (with the "& 7f") will generate the same final value. In particular, the byte pair upperByte=0x4c and lowerByte=0xff gives the final integer value 0x7f4d, the same as upperByte=0x4c and lowerByte=0x7f.
Is that really what you wanted?