solution for 32-bit z values in opencl and other minor optimizations