fix bit operator casts in C++
namespace ckdb
{
extern "C" {
-#endif
+
+/** Test a bit. @see set_bit(), clear_bit() */
+#define test_bit(var, bit) ((static_cast<unsigned long long> (var)) & (static_cast<unsigned long long> (bit)))
+/** Set a bit. @see clear_bit() */
+#define set_bit(var, bit) ((var) |= (static_cast<unsigned long long> (bit)))
+/** Clear a bit. @see set_bit() */
+#define clear_bit(var, bit) ((var) &= ~(static_cast<unsigned long long> (bit)))
+
+#else
/** Test a bit. @see set_bit(), clear_bit() */
#define test_bit(var, bit) (((unsigned long long) (var)) & ((unsigned long long) (bit)))
@@ -69,6 +77,9 @@ extern "C" {
/** Clear a bit. @see set_bit() */
#define clear_bit(var, bit) ((var) &= ~((unsigned long long) (bit)))
+#endif
+
+
/* These define the type for pointers to all the kdb functions */
typedef int (*kdbOpenPtr) (Plugin *, Key * errorKey);
typedef int (*kdbClosePtr) (Plugin *, Key * errorKey);
