summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/tinycbor/src/cborinternal_p.h
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2019-10-15 16:38:27 -0700
committerThiago Macieira <thiago.macieira@intel.com>2021-01-22 03:02:39 -0800
commitcbdf2ba46aed53d002b90d4d9683c28306f8e0a9 (patch)
tree65bf71abe419c47d3d6aeff1d794d742cb8a5f7b /src/3rdparty/tinycbor/src/cborinternal_p.h
parente425a2a4b8dd469920eede57e9c4094523aa9ad7 (diff)
Update TinyCBOR
Updated to commit e6a4fa4862bcc3a6f6b07cf9d9b784d0ab6068b4. Pick-to: 6.0 Fixes: QTBUG-89650 Task-number: QTBUG-90214 Change-Id: I6edce5101800424a8093fffd15cdf6591cbf809d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/3rdparty/tinycbor/src/cborinternal_p.h')
-rw-r--r--src/3rdparty/tinycbor/src/cborinternal_p.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/3rdparty/tinycbor/src/cborinternal_p.h b/src/3rdparty/tinycbor/src/cborinternal_p.h
index c5fe63003f..8dc0c13d3c 100644
--- a/src/3rdparty/tinycbor/src/cborinternal_p.h
+++ b/src/3rdparty/tinycbor/src/cborinternal_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2018 Intel Corporation
+** Copyright (C) 2019 Intel Corporation
**
** Permission is hereby granted, free of charge, to any person obtaining a copy
** of this software and associated documentation files (the "Software"), to deal
@@ -37,15 +37,17 @@
#endif
#ifndef CBOR_NO_HALF_FLOAT_TYPE
-# ifdef __F16C__
+# if defined(__F16C__) || defined(__AVX2__)
# include <immintrin.h>
-static inline unsigned short encode_half(double val)
+static inline unsigned short encode_half(float val)
{
- return _cvtss_sh((float)val, 3);
+ __m128i m = _mm_cvtps_ph(_mm_set_ss(val), _MM_FROUND_CUR_DIRECTION);
+ return _mm_extract_epi16(m, 0);
}
-static inline double decode_half(unsigned short half)
+static inline float decode_half(unsigned short half)
{
- return _cvtsh_ss(half);
+ __m128i m = _mm_cvtsi32_si128(half);
+ return _mm_cvtss_f32(_mm_cvtph_ps(m));
}
# else
/* software implementation of float-to-fp16 conversions */