Skip to content

Commit 1c095e7

Browse files
k3aMario Hros
and
Mario Hros
authored
use lazy binding on lzcnt64_hard to compile on platforms without lzcnt64_hard symbol (#86)
Co-authored-by: Mario Hros <[email protected]>
1 parent f9b8c93 commit 1c095e7

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/Reducer.h

+13-1
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,22 @@ limitations under the License.
2323

2424
#include "ClassGroup.h"
2525

26+
#ifdef __has_attribute
27+
# define HAS_ATTRIBUTE(x) __has_attribute(x)
28+
#else
29+
# define HAS_ATTRIBUTE(x) 0
30+
#endif
31+
32+
#if HAS_ATTRIBUTE(weak)
33+
# define WEAK __attribute__((weak))
34+
#else
35+
# define WEAK
36+
#endif
37+
2638
extern "C" {
2739
int has_lzcnt_hard();
2840
unsigned int lzcnt64_soft(unsigned long long x);
29-
unsigned int lzcnt64_hard(unsigned long long x);
41+
unsigned int lzcnt64_hard(unsigned long long x) WEAK;
3042
}
3143

3244
/** constants utilized in reduction algorithm */

0 commit comments

Comments
 (0)