From 918b8f28d1b55bb2f777fb901339edc5ea7a6d5d Mon Sep 17 00:00:00 2001 From: Pan Xiuli Date: Mon, 8 Aug 2016 11:31:20 +0800 Subject: Utest: Add as_float as_uint helper function These functions are used with half float convert funcitons. Signed-off-by: Pan Xiuli Reviewed-by: Yang Rong --- utests/utest_helper.hpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'utests/utest_helper.hpp') diff --git a/utests/utest_helper.hpp b/utests/utest_helper.hpp index 561c2c4a..5f2fea68 100644 --- a/utests/utest_helper.hpp +++ b/utests/utest_helper.hpp @@ -52,6 +52,11 @@ extern EGLContext eglContext; extern EGLSurface eglSurface; #endif +union uint32_cast { + uint32_t _uint; + float _float; +}; + #define OCL_THROW_ERROR(FN, STATUS) \ do { \ char msg[2048]; \ @@ -306,4 +311,6 @@ extern int cl_check_half(void); /* Helper function for half type numbers */ extern uint32_t __half_to_float(uint16_t h, bool* isInf = NULL, bool* infSign = NULL); extern uint16_t __float_to_half(uint32_t x); +extern float as_float(uint32_t i); +extern uint32_t as_uint(float f); #endif /* __UTEST_HELPER_HPP__ */ -- cgit v1.2.1