Created bit manipulation functions for Huffman encoding