source: trunk/lib_c/transpose.h @ 4277

Last change on this file since 4277 was 3391, checked in by linmengl, 6 years ago

check in IDISA C library and other support libraries. Some template features still remain.

File size: 1.8 KB
Line 
1/* Generated by cpp2c.rb from ./transpose.hpp
2 * Use IDISA C support
3*/
4
5#ifndef TRANSPOSE_H
6#define TRANSPOSE_H
7
8#include "bitblock.h"
9#include "s2p.h"
10
11#ifdef BASIS_BITS
12typedef struct Basis_bits {
13    BitBlock bit_0;
14    BitBlock bit_1;
15    BitBlock bit_2;
16    BitBlock bit_3;
17    BitBlock bit_4;
18    BitBlock bit_5;
19    BitBlock bit_6;
20    BitBlock bit_7;
21} Basis_bits;
22#endif
23
24static inline void s2p_do_block(BytePack U8[], Basis_bits & basis_bits);
25static inline void s2p_do_final_block(BytePack U8[], Basis_bits & basis_bits, BitBlock EOF_mask);
26
27static IDISA_ALWAYS_INLINE void s2p_do_block(BytePack U8[], Basis_bits & basis_bits) {
28  s2p(U8[0], U8[1], U8[2], U8[3], U8[4], U8[5], U8[6], U8[7],
29    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);
30}
31
32static IDISA_ALWAYS_INLINE void s2p_do_final_block(BytePack U8[], Basis_bits & basis_bits, BitBlock EOF_mask) {
33  s2p_do_block(U8, basis_bits);
34  basis_bits.bit_0 = simd_and(basis_bits.bit_0, EOF_mask);
35  basis_bits.bit_1 = simd_and(basis_bits.bit_1, EOF_mask);
36  basis_bits.bit_2 = simd_and(basis_bits.bit_2, EOF_mask);
37  basis_bits.bit_3 = simd_and(basis_bits.bit_3, EOF_mask);
38  basis_bits.bit_4 = simd_and(basis_bits.bit_4, EOF_mask);
39  basis_bits.bit_5 = simd_and(basis_bits.bit_5, EOF_mask);
40  basis_bits.bit_6 = simd_and(basis_bits.bit_6, EOF_mask);
41  basis_bits.bit_7 = simd_and(basis_bits.bit_7, EOF_mask);
42}
43
44struct Transpose {
45  Transpose() {}
46  void do_block(char * bytedata, Basis_bits & basis_bits) {
47    s2p_do_block((BytePack *) bytedata, basis_bits);
48  }
49  void do_final_block(char * bytedata, Basis_bits & basis_bits, BitBlock EOF_mask) {
50    s2p_do_final_block((BytePack *) bytedata, basis_bits, EOF_mask);
51  }
52};
53#endif // TRANSPOSE_H
54
55
Note: See TracBrowser for help on using the repository browser.