We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 69262ff commit d0b61eaCopy full SHA for d0b61ea
1 file changed
numeric_types/half.h
@@ -11,6 +11,17 @@ struct half;
11
static half halfFromFloat(float f);
12
static float halfToFloat(half h);
13
14
+#ifdef _MSC_VER
15
+#include <intrin.h>
16
+static inline uint16_t __builtin_clz(uint16_t value) {
17
+ unsigned long leading_zero = 0;
18
+ if (_BitScanReverse(&leading_zero, static_cast<unsigned long>(value))) {
19
+ return 15 - leading_zero;
20
+ }
21
+ return 16;
22
+}
23
+#endif
24
+
25
/**
26
* Experimental implementation of half-precision 16-bit floating point numbers.
27
*/
0 commit comments