Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef BIT_UTILS
- #define BIT_UTILS
- #include <vector>
- typedef unsigned char byte;
- struct bits
- {
- std::vector<byte> b;
- int size;
- };
- /* return the byte in position n */
- template<class byte_iterator>
- byte get_byte(byte_iterator begin, int n);
- /* return n bit starting from the bit in start */
- template<class byte_iterator>
- bits get_bits(byte_iterator begin, int start, int n);
- /* insert n bits in begin at start*/
- template<class byte_iterator>
- void bits_insert(const bits& b, byte_iterator begin, int start, int n);
- /* return number of bits matching in the two bytes, supposed different */
- int bit_compare(byte a, byte b);
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement