The code attached checks the CRC of the returned data from dallas onewire devices and returns 0 if no errors are found, -1 if all zeros are input or the number of bits remaining set at the end of the cycle.
It assumes the returned data from OWIN is in an Inbytes array of 0-8 = 9 bytes, as per the OWIN example.