It does save one step for white pixels (You have to enter it as rayheight = (float)254/255; or alternatively 0.996)
but for some reason it also seems to cause the results from that first step to be offset 1 step backwards instead of receiving 0 offset. It does seem very close to working though, great suggestion.