summaryrefslogtreecommitdiff
path: root/utests/utest_helper.hpp
diff options
context:
space:
mode:
authorPan Xiuli <xiuli.pan@intel.com>2016-08-08 11:31:20 +0800
committerYang Rong <rong.r.yang@intel.com>2016-08-12 18:16:25 +0800
commit918b8f28d1b55bb2f777fb901339edc5ea7a6d5d (patch)
tree169f835a9d16caa8a74995356de16cca5121cb02 /utests/utest_helper.hpp
parentccf1f13e1218f94ac77e47a6e32b1ddda88796a7 (diff)
downloadbeignet-918b8f28d1b55bb2f777fb901339edc5ea7a6d5d.tar.gz
Utest: Add as_float as_uint helper function
These functions are used with half float convert funcitons. Signed-off-by: Pan Xiuli <xiuli.pan@intel.com> Reviewed-by: Yang Rong <rong.r.yang@intel.com>
Diffstat (limited to 'utests/utest_helper.hpp')
-rw-r--r--utests/utest_helper.hpp7
1 files changed, 7 insertions, 0 deletions
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__ */