Added extra casting protection on bit_test macro.