source: trunk/lib/transpose.hpp @ 2149

Last change on this file since 2149 was 2149, checked in by ksherdy, 7 years ago

Added common transpose routine.

File size: 1.4 KB
Line 
1#ifndef TRANSPOSE_HPP
2#define TRANSPOSE_HPP
3
4#include "bitblock.hpp"
5#include "s2p.hpp"
6
7/*
8typedef struct Basis_bits {
9    BitBlock bit_0;
10    BitBlock bit_1;
11    BitBlock bit_2;
12    BitBlock bit_3;
13    BitBlock bit_4;
14    BitBlock bit_5;
15    BitBlock bit_6;
16    BitBlock bit_7;
17} Basis_bits;
18*/
19
20static inline void s2p_do_block(BytePack U8[], Basis_bits & basis_bits);
21static inline void s2p_do_final_block(BytePack U8[], Basis_bits & basis_bits, BitBlock EOF_mask);
22
23static IDISA_ALWAYS_INLINE void s2p_do_block(BytePack U8[], Basis_bits & basis_bits) {
24  s2p(U8[0], U8[1], U8[2], U8[3], U8[4], U8[5], U8[6], U8[7],
25    basis_bits.bit_0, basis_bits.bit_1, basis_bits.bit_2, basis_bits.bit_3, basis_bits.bit_4, basis_bits.bit_5, basis_bits.bit_6, basis_bits.bit_7);
26}
27
28static IDISA_ALWAYS_INLINE void s2p_do_final_block(BytePack U8[], Basis_bits & basis_bits, BitBlock EOF_mask) {
29  s2p_do_block(U8, basis_bits);
30  basis_bits.bit_0 = simd_and(basis_bits.bit_0, EOF_mask);
31  basis_bits.bit_1 = simd_and(basis_bits.bit_1, EOF_mask);
32  basis_bits.bit_2 = simd_and(basis_bits.bit_2, EOF_mask);
33  basis_bits.bit_3 = simd_and(basis_bits.bit_3, EOF_mask);
34  basis_bits.bit_4 = simd_and(basis_bits.bit_4, EOF_mask);
35  basis_bits.bit_5 = simd_and(basis_bits.bit_5, EOF_mask);
36  basis_bits.bit_6 = simd_and(basis_bits.bit_6, EOF_mask);
37  basis_bits.bit_7 = simd_and(basis_bits.bit_7, EOF_mask);
38}
39
40#endif // TRANSPOSE_HPP
41
Note: See TracBrowser for help on using the repository browser.