8 #define PTLUT_SIZE (1 << 30)
21 if (not(denom_ == 64))
27 std::cout <<
"Writing LUT, this might take a while..." << std::endl;
29 std::ofstream
outfile(lut_full_path, std::ios::binary);
32 snprintf(what,
sizeof(what),
"Fail to open %s", lut_full_path.c_str());
33 throw std::invalid_argument(what);
38 snprintf(what,
sizeof(what),
"ptlut_.size() is %lu != %i",
ptlut_.size(),
PTLUT_SIZE);
39 throw std::invalid_argument(what);
46 full_word_t full_word;
47 full_word_t sub_word[4] = {0, 0, 0, 0};
49 table_t::const_iterator ptlut_it =
ptlut_.begin();
50 table_t::const_iterator ptlut_end =
ptlut_.end();
52 while (ptlut_it != ptlut_end) {
53 sub_word[0] = *ptlut_it++;
54 sub_word[1] = *ptlut_it++;
55 sub_word[2] = *ptlut_it++;
56 sub_word[3] = *ptlut_it++;
59 full_word |= ((sub_word[0] & 0x1FF) << 0);
60 full_word |= ((sub_word[1] & 0x1FF) << 9);
61 full_word |= ((sub_word[2] & 0x1FF) << 32);
62 full_word |= ((sub_word[3] & 0x1FF) << (32 + 9));
64 outfile.write(reinterpret_cast<char*>(&full_word),
sizeof(full_word_t));