25 if (not(denom_ == 64))
28 std::cout <<
"Writing LUT, this might take a while..." << std::endl;
30 std::ofstream
outfile(lut_full_path, std::ios::binary);
33 snprintf(what,
sizeof(what),
"Fail to open %s", lut_full_path.c_str());
34 throw std::invalid_argument(what);
39 snprintf(what,
sizeof(what),
"ptlut_.size() is %lu != %i",
ptlut_.size(),
PTLUT_SIZE);
40 throw std::invalid_argument(what);
47 full_word_t full_word;
48 full_word_t sub_word[4] = {0, 0, 0, 0};
50 table_t::const_iterator ptlut_it =
ptlut_.begin();
51 table_t::const_iterator ptlut_end =
ptlut_.end();
53 while (ptlut_it != ptlut_end) {
54 sub_word[0] = *ptlut_it++;
55 sub_word[1] = *ptlut_it++;
56 sub_word[2] = *ptlut_it++;
57 sub_word[3] = *ptlut_it++;
60 full_word |= ((sub_word[0] & 0x1FF) << 0);
61 full_word |= ((sub_word[1] & 0x1FF) << 9);
62 full_word |= ((sub_word[2] & 0x1FF) << 32);
63 full_word |= ((sub_word[3] & 0x1FF) << (32+9));
65 outfile.write(reinterpret_cast<char*>(&full_word),
sizeof(full_word_t));
unsigned long long uint64_t