gr-habets/lib/bitpacker_impl.cc
uint8_t
    bits_to_byte(const uint8_t* b, const uint8_t* e)
    {
      uint8_t t = 0;
      const uint8_t* p = b;
      for (int c = 0; p < e; c++) {
        t <<= 1;
        if (*p++) {
          t |= 1;
        }
      }
      if (e - b < 8) {
        t <<= (8- (e-b));
      }
      return t;
    }
// Turn up to bits into a byte. MSB.
// If fewer than 8 bits, the bits will be treated as the higher bits.
Turn up to bits into a byte. MSB.
If fewer than 8 bits, the bits will be treated as the higher bits.
Turn up to bits into a byte . MSB . If fewer than 8 bits the bits will be treated as the higher bits .
uint8_t
    bits_to_byte(const uint8_t* b, const uint8_t* e)
    {
      uint8_t t = 0;
      const uint8_t* p = b;
      for (int c = 0; p < e; c++) {
        t <<= 1;
        if (*p++) {
          t |= 1;
        }
      }
      if (e - b < 8) {
        t <<= (8- (e-b));
      }
      return t;
    }
uint8_t bits_to_byte ( const uint8_t * b , const uint8_t * e ) { uint8_t t = 0 ; const uint8_t * p = b ; for ( int c = 0 ; p < e ; c ++ ) { t <<= 1 ; if ( * p ++ ) { t |= 1 ; } } if ( e - b < 8 ) { t <<= ( 8 - ( e - b ) ) ; } return t ; }
Turn up to bits into a byte.
Turn up to bits into a byte .