Skip to content

Commit c34c540

Browse files
committed
Fix the counting of zeros to work pre-Haswell.
1 parent 447f988 commit c34c540

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/binary64/cos/cos.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ SOFTWARE.
3535
#include <stdint.h>
3636
#include <fenv.h>
3737

38+
#include <bit>
3839
#include <cmath>
3940

4041
#include "absl/numeric/int128.h"
@@ -48,7 +49,7 @@ SOFTWARE.
4849

4950
#if defined(_MSC_VER)
5051
#ifndef __builtin_clzl
51-
#define __builtin_clzl(x) __lzcnt64(x)
52+
#define __builtin_clzl(x) std::countl_zero(x)
5253
#endif
5354
#ifndef __builtin_fma
5455
#define __builtin_fma(x, y, z) std::fma(x, y, z)

src/binary64/sin/sin.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ SOFTWARE.
3535
#include <stdint.h>
3636
#include <fenv.h>
3737

38+
#include <bit>
3839
#include <cmath>
3940

4041
#include "absl/numeric/int128.h"
@@ -48,7 +49,7 @@ SOFTWARE.
4849

4950
#if defined(_MSC_VER)
5051
#ifndef __builtin_clzl
51-
#define __builtin_clzl(x) __lzcnt64(x)
52+
#define __builtin_clzl(x) std::countl_zero(x)
5253
#endif
5354
#ifndef __builtin_fma
5455
#define __builtin_fma(x, y, z) std::fma(x, y, z)

0 commit comments

Comments
 (0)