Skip to content

Commit 401e43a

Browse files
committed
patch: google#102
1 parent ccf9f05 commit 401e43a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/zopfli/symbols.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@ Utilities for using the lz77 symbols of the deflate spec.
3232
/* __builtin_clz available beginning with GCC 3.4 */
3333
#elif __GNUC__ * 100 + __GNUC_MINOR__ >= 304
3434
# define ZOPFLI_HAS_BUILTIN_CLZ
35+
/* _BitScanReverse available beginning with Visual Studio 2005 */
36+
#elif _MSC_VER >= 1400
37+
# include <intrin.h>
38+
# define ZOPFLI_HAS_BUILTIN_CLZ
39+
static int __inline __builtin_clz(unsigned int x) {
40+
unsigned long r;
41+
_BitScanReverse(&r, x);
42+
return 31 ^ r;
43+
}
3544
#endif
3645

3746
/* Gets the amount of extra bits for the given dist, cfr. the DEFLATE spec. */

0 commit comments

Comments
 (0)