We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 960007e commit 14ee911Copy full SHA for 14ee911
lstm/lstm.cpp
@@ -24,6 +24,10 @@
24
#include <stdio.h>
25
#include <stdlib.h>
26
27
+#if !defined(__GNUC__) && defined(_MSC_VER)
28
+#include <intrin.h> // _BitScanReverse
29
+#endif
30
+
31
#include "fullyconnected.h"
32
#include "functions.h"
33
#include "networkscratch.h"
@@ -74,6 +78,10 @@ static inline uint32_t ceil_log2(uint32_t n)
74
78
#if defined(__GNUC__)
75
79
// Use fast inline assembler code for gcc or clang.
76
80
uint32_t l2 = 31 - __builtin_clz(n);
81
+#elif defined(_MSC_VER)
82
+ // Use fast intrinsic function for MS compiler.
83
+ unsigned long l2 = 0;
84
+ _BitScanReverse(&l2, n);
77
85
#else
86
if (n == 0) return UINT_MAX;
87
if (n == 1) return 0;
0 commit comments