| 64 | return s; |
| 65 | } |
| 66 | Spec raw(const std::string& name, uint32_t type, uint64_t cols, uint64_t rows, size_t block_elems, size_t block_bytes) { |
| 67 | const size_t blocks = (size_t) (cols * rows) / block_elems; |
| 68 | Spec s{name, type, {cols, rows}, std::vector<uint8_t>(blocks * block_bytes)}; |
| 69 | for (auto& b : s.data) b = (uint8_t) rnd(); |
| 70 | return s; |
| 71 | } |
| 72 | |
| 73 | void put32(std::vector<uint8_t>& o, uint32_t v) { o.insert(o.end(), (uint8_t*) &v, (uint8_t*) &v + 4); } |
| 74 | void put64(std::vector<uint8_t>& o, uint64_t v) { o.insert(o.end(), (uint8_t*) &v, (uint8_t*) &v + 8); } |