#ifndef BIN64_H
#define BIN64_H
#include <assert.h>
-#ifdef _MSC_VER
- #include "compat/stdint.h"
-#else
- #include <stdint.h>
-#endif
+#include "compat.h"
/** Numbering for (aligned) logarithmical bins.
bin64_t to (bool right) const {
if (!(v&1))
return NONE;
- uint64_t tb = tail_bit()>>1;
+ uint64_t tb = ((tail_bits() >> 1) + 1) >> 1;
if (right)
- tb |= (tb<<1);
- return bin64_t(v^tb);
+ return bin64_t(v + tb);
+ return bin64_t(v ^ tb);
}
/** Get the left child bin. */
}
/** Check whether this bin is the left sibling. */
- bool is_left () const {
+ inline bool is_left () const {
uint64_t tb = tail_bit();
return !(v&(tb<<1));
}
/** Check whether this bin is the right sibling. */
- bool is_right() const { return !is_left(); }
+ inline bool is_right() const { return !is_left(); }
/** Get the leftmost basic bin within this bin. */
bin64_t left_foot () const {