Skip to content

Commit fefbced

Browse files
BMat8: rows array by reference
1 parent 665c9be commit fefbced

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

include/bmat8.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,14 @@ class BMat8 {
194194
//! Returns a \c std::vector for rows of \c this
195195
std::vector<uint8_t> rows() const;
196196

197+
//! Returns a \c std::vector for rows of \c this
198+
//! This is the same as BMat8::rows, which is retained for backwards
199+
//! compatibility.
200+
std::vector<uint8_t> row_vector() const;
201+
202+
//! Returns a \c std::array for rows of \c this
203+
std::array<uint8_t, 8> row_array() const;
204+
197205
//! Returns the cardinality of the row space of \c this
198206
//!
199207
//! Reference implementation computing all products

include/bmat8_impl.hpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,10 @@ inline uint64_t BMat8::row_space_size_ref() const {
389389
}
390390

391391
inline std::vector<uint8_t> BMat8::rows() const {
392+
return row_vector();
393+
}
394+
395+
inline std::vector<uint8_t> BMat8::row_vector() const {
392396
std::vector<uint8_t> rows;
393397
for (size_t i = 0; i < 8; ++i) {
394398
uint8_t row = static_cast<uint8_t>(_data << (8 * i) >> 56);
@@ -397,6 +401,15 @@ inline std::vector<uint8_t> BMat8::rows() const {
397401
return rows;
398402
}
399403

404+
inline std::array<uint8_t, 8> BMat8::row_array() const {
405+
std::array<uint8_t, 8> rows;
406+
rows.fill(0);
407+
for (size_t i = 0; i < 8; ++i) {
408+
rows[i] = static_cast<uint8_t>(_data << (8 * i) >> 56);
409+
}
410+
return rows;
411+
}
412+
400413
inline size_t BMat8::nr_rows() const {
401414
epu8 x = _mm_set_epi64x(_data, 0);
402415
return _mm_popcnt_u64(_mm_movemask_epi8(x != epu8 {}));

0 commit comments

Comments
 (0)