bunch of bit hacking functions