Classes | Functions
dune::frame14 Namespace Reference

Classes

struct  __attribute__
 

Functions

 aligned (4))) frame14
 
uint16_t unpack14 (const uint32_t *packed, size_t i)
 

Function Documentation

dune::frame14::aligned ( )
uint16_t dune::frame14::unpack14 ( const uint32_t *  packed,
size_t  i 
)
inline

Definition at line 31 of file Frame14Format.hh.

31  {
32  const size_t low_bit = i*14;
33  const size_t low_word = low_bit / 32;
34  const size_t high_bit = (i+1)*14-1;
35  const size_t high_word = high_bit / 32;
36  //printf("word %li :: low %li (%li[%li]) high %li (%li[%li])\n",i,low_bit,low_word,low_bit%32,high_bit,high_word,high_bit%32);
37  if (low_word == high_word) { //all the bits are in the same word
38  return (packed[low_word] >> (low_bit%32)) & 0x3FFF;
39  } else { //some of the bits are in the next word
40  size_t high_off = high_word*32-low_bit;
41  //printf("pre_mask 0x%X post_mask 0x%X\n", (0x3FFF >> (14-high_off)), ((0x3FFF << high_off) & 0x3FFF) );
42  uint16_t result = (packed[low_word] >> (low_bit%32)) & (0x3FFF >> (14-high_off));
43  result |= (packed[high_word] << high_off) & ((0x3FFF << high_off) & 0x3FFF);
44  return result;
45  }
46 }
static QCString result