]> git.sesse.net Git - plocate/blobdiff - turbopfor-encode.h
Fix writing of the configuration block.
[plocate] / turbopfor-encode.h
index d149ae75ce85dd6b4a08392d652e991c488d22d0..24e007cdc070e902bb9ea4b250b9d8bbb1d33505 100644 (file)
@@ -15,6 +15,9 @@
 
 #include <algorithm>
 #include <assert.h>
+#ifdef HAS_ENDIAN_H
+#include <endian.h>
+#endif
 #include <limits.h>
 #include <stdint.h>
 #include <string.h>
@@ -101,8 +104,8 @@ inline unsigned num_bits(Docid x)
                return sizeof(Docid) * CHAR_BIT - __builtin_clz(x);
        }
 #else
-       for (int i = sizeof(Docid) * CHAR_BIT; i-- > 0; ) {
-               if (x & (Docid{1} << i)) {
+       for (int i = sizeof(Docid) * CHAR_BIT; i-- > 0;) {
+               if (x & (Docid{ 1 } << i)) {
                        return i;
                }
        }