File tree Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change 1010#include < MNN/expr/MathOp.hpp>
1111#include < MNN/expr/NeuralNetWorkOp.hpp>
1212#include < cmath>
13+ #include < algorithm>
1314#include < complex>
1415#include < fstream>
1516#include < iostream>
1617#include < limits>
1718#ifndef M_PI
1819#define M_PI 3.141592654
1920#endif
21+ #ifdef _MSC_VER
22+ #define NOMINMAX
23+ #include < intrin.h>
24+ #include < windows.h>
25+ #endif
2026
2127namespace MNN {
2228namespace AUDIO {
23-
29+ #ifdef _MSC_VER
30+ inline uint32_t mnn_clz ( uint32_t value ) {
31+ DWORD leading_zero = 0 ;
32+ if (_BitScanReverse (&leading_zero, value)) {
33+ return 31 - leading_zero;
34+ }else {
35+ // Same remarks as above
36+ return 32 ;
37+ }
38+ }
39+ #else
40+ inline uint32_t mnn_clz ( uint32_t value ) {
41+ return __builtin_clz (value);
42+ }
43+ #endif
2444struct WaveHeader {
2545 void SeekToDataChunk (std::istream &is) {
2646 // a t a d
@@ -263,7 +283,7 @@ unsigned int next_power_of_2(unsigned int x) {
263283 return 1 ;
264284 if ((x & (x - 1 )) == 0 )
265285 return x;
266- return 1U << (32 - __builtin_clz (x));
286+ return 1U << (32 - mnn_clz (x));
267287}
268288
269289VARP hamming_window (int n_fft, bool periodic, float alpha, float beta) {
You can’t perform that action at this time.
0 commit comments