s2w diff implementation