1-4 looks good to me, with one question:
+#define MASK_BITS ((uintptr_t) 0x55aa55aa55aa55aa)
Won't this cause a warning in 32 bit builds? (0x55aa55aa definitelyshould work in both?)