Closed jfoug closed 8 years ago
Here is another patch, I had to apply for cygwin-32 bit build (it was lacking ffsll() ) NOTE, I think ffsll should be there, I simply did not know the right compiler switch to get it working.
So instead I used the non-inline stuff, and found other problems.
$ git diff librexgen/common/ntz*
diff --git a/src/librexgen/common/ntz.cpp b/src/librexgen/common/ntz.cpp
index 43c2b64..2427d3a 100644
--- a/src/librexgen/common/ntz.cpp
+++ b/src/librexgen/common/ntz.cpp
@@ -47,7 +47,7 @@ int ntz11(unsigned int n) {
#if ! defined(__USE_INLINE_NTZ__)
#if __x86_64__
-unsigned int ntz(long long unsigned int x) {
+unsigned int ntz(uint64_t x) {
const unsigned int lower_part = (const unsigned int) (x & 0x00000000ffffffff);
/* no need to AND-out the 32 right-most here,
* since they are shifted out */
@@ -61,7 +61,7 @@ unsigned int ntz(long long unsigned int x) {
}
#else
-unsigned int ntz(long unsigned int x) {
+unsigned int ntz(uint32_t x) {
return ntz11(x);
}
#endif /* __x86_64__ */
diff --git a/src/librexgen/common/ntz.h b/src/librexgen/common/ntz.h
index 96bbbc2..39065c8 100644
--- a/src/librexgen/common/ntz.h
+++ b/src/librexgen/common/ntz.h
@@ -25,7 +25,9 @@
int ntz11(unsigned int n);
+#if ! (!__x64_64__ && __CYGWIN__)
#define __USE_INLINE_NTZ__
+#endif
#ifdef __USE_INLINE_NTZ__
#if __x86_64__
Under cygwin (64 bit but likely affects 32 bit also), I had to make these edits, or I end up with fileno not defined.