12#ifndef FDDETDATAFORMATS_INCLUDE_FDDETDATAFORMATS_WIB2FRAME_HPP_
13#define FDDETDATAFORMATS_INCLUDE_FDDETDATAFORMATS_WIB2FRAME_HPP_
91 throw std::out_of_range(
"ADC index out of range");
100 uint16_t adc =
adc_words[word_index] >> first_bit_position;
104 adc |=
adc_words[word_index + 1] << bits_from_first_word;
107 return adc & 0x3FFFu;
116 throw std::out_of_range(
"ADC index out of range");
118 throw std::out_of_range(
"ADC value out of range");
127 uint32_t mask = (1 << (first_bit_position)) - 1;
128 adc_words[word_index] = ((val << first_bit_position) & ~mask) | (
adc_words[word_index] & mask);
133 adc_words[word_index + 1] = ((val >> bits_in_first_word) & mask) | (
adc_words[word_index + 1] & ~mask);
141 return (uint64_t)
header.timestamp_1 | ((uint64_t)
header.timestamp_2 << 32);
148 header.timestamp_1 = new_timestamp;
149 header.timestamp_2 = new_timestamp >> 32;