refactored some functions from ocl arithm
Merge pull request #1790 from ilya-lavrenov:ocl_ref