|
6 | 6 |
|
7 | 7 | /* This file was substantially auto-generated by doc/gen_params.sage. */
|
8 | 8 |
|
9 |
| -#include <stdint.h> |
| 9 | +#if !defined(DISABLE_FIELD_2) || !defined(DISABLE_FIELD_3) || !defined(DISABLE_FIELD_4) || !defined(DISABLE_FIELD_5) || !defined(DISABLE_FIELD_6) || !defined(DISABLE_FIELD_7) || !defined(DISABLE_FIELD_8) |
10 | 10 |
|
11 | 11 | #include "clmul_common_impl.h"
|
12 | 12 |
|
13 | 13 | #include "../int_utils.h"
|
14 | 14 | #include "../lintrans.h"
|
15 | 15 | #include "../sketch_impl.h"
|
| 16 | + |
| 17 | +#endif |
| 18 | + |
16 | 19 | #include "../sketch.h"
|
17 | 20 |
|
18 | 21 | namespace {
|
19 |
| - |
| 22 | +#ifndef DISABLE_FIELD_2 |
20 | 23 | // 2 bit field
|
21 | 24 | typedef RecLinTrans<uint8_t, 2> StatTableTRI2;
|
22 | 25 | constexpr StatTableTRI2 SQR_TABLE_TRI2({0x1, 0x3});
|
23 | 26 | constexpr StatTableTRI2 QRT_TABLE_TRI2({0x2, 0});
|
24 | 27 | typedef FieldTri<uint8_t, 2, 1, StatTableTRI2, &SQR_TABLE_TRI2, nullptr, nullptr, nullptr, nullptr, &QRT_TABLE_TRI2, IdTrans, &ID_TRANS, &ID_TRANS> FieldTri2;
|
| 28 | +#endif |
25 | 29 |
|
| 30 | +#ifndef DISABLE_FIELD_3 |
26 | 31 | // 3 bit field
|
27 | 32 | typedef RecLinTrans<uint8_t, 3> StatTableTRI3;
|
28 | 33 | constexpr StatTableTRI3 SQR_TABLE_TRI3({0x1, 0x4, 0x6});
|
29 | 34 | constexpr StatTableTRI3 QRT_TABLE_TRI3({0, 0x4, 0x6});
|
30 | 35 | typedef FieldTri<uint8_t, 3, 1, StatTableTRI3, &SQR_TABLE_TRI3, nullptr, nullptr, nullptr, nullptr, &QRT_TABLE_TRI3, IdTrans, &ID_TRANS, &ID_TRANS> FieldTri3;
|
| 36 | +#endif |
31 | 37 |
|
| 38 | +#ifndef DISABLE_FIELD_4 |
32 | 39 | // 4 bit field
|
33 | 40 | typedef RecLinTrans<uint8_t, 4> StatTableTRI4;
|
34 | 41 | constexpr StatTableTRI4 SQR_TABLE_TRI4({0x1, 0x4, 0x3, 0xc});
|
35 | 42 | constexpr StatTableTRI4 QRT_TABLE_TRI4({0x6, 0xa, 0x8, 0});
|
36 | 43 | typedef FieldTri<uint8_t, 4, 1, StatTableTRI4, &SQR_TABLE_TRI4, nullptr, nullptr, nullptr, nullptr, &QRT_TABLE_TRI4, IdTrans, &ID_TRANS, &ID_TRANS> FieldTri4;
|
| 44 | +#endif |
37 | 45 |
|
| 46 | +#ifndef DISABLE_FIELD_5 |
38 | 47 | // 5 bit field
|
39 | 48 | typedef RecLinTrans<uint8_t, 5> StatTable5;
|
40 | 49 | constexpr StatTable5 SQR_TABLE_5({0x1, 0x4, 0x10, 0xa, 0xd});
|
41 | 50 | constexpr StatTable5 SQR2_TABLE_5({0x1, 0x10, 0xd, 0xe, 0x1b});
|
42 | 51 | constexpr StatTable5 QRT_TABLE_5({0x14, 0x8, 0xa, 0, 0xe});
|
43 | 52 | typedef Field<uint8_t, 5, 5, StatTable5, &SQR_TABLE_5, &SQR2_TABLE_5, nullptr, nullptr, nullptr, &QRT_TABLE_5, IdTrans, &ID_TRANS, &ID_TRANS> Field5;
|
44 | 53 | typedef FieldTri<uint8_t, 5, 2, RecLinTrans<uint8_t, 5>, &SQR_TABLE_5, &SQR2_TABLE_5, nullptr, nullptr, nullptr, &QRT_TABLE_5, IdTrans, &ID_TRANS, &ID_TRANS> FieldTri5;
|
| 54 | +#endif |
45 | 55 |
|
| 56 | +#ifndef DISABLE_FIELD_6 |
46 | 57 | // 6 bit field
|
47 | 58 | typedef RecLinTrans<uint8_t, 6> StatTableTRI6;
|
48 | 59 | constexpr StatTableTRI6 SQR_TABLE_TRI6({0x1, 0x4, 0x10, 0x3, 0xc, 0x30});
|
49 | 60 | constexpr StatTableTRI6 SQR2_TABLE_TRI6({0x1, 0x10, 0xc, 0x5, 0x13, 0x3c});
|
50 | 61 | constexpr StatTableTRI6 QRT_TABLE_TRI6({0x3a, 0x26, 0x24, 0x14, 0x20, 0});
|
51 | 62 | typedef FieldTri<uint8_t, 6, 1, StatTableTRI6, &SQR_TABLE_TRI6, &SQR2_TABLE_TRI6, nullptr, nullptr, nullptr, &QRT_TABLE_TRI6, IdTrans, &ID_TRANS, &ID_TRANS> FieldTri6;
|
| 63 | +#endif |
52 | 64 |
|
| 65 | +#ifndef DISABLE_FIELD_7 |
53 | 66 | // 7 bit field
|
54 | 67 | typedef RecLinTrans<uint8_t, 4, 3> StatTableTRI7;
|
55 | 68 | constexpr StatTableTRI7 SQR_TABLE_TRI7({0x1, 0x4, 0x10, 0x40, 0x6, 0x18, 0x60});
|
56 | 69 | constexpr StatTableTRI7 SQR2_TABLE_TRI7({0x1, 0x10, 0x6, 0x60, 0x14, 0x46, 0x78});
|
57 | 70 | constexpr StatTableTRI7 QRT_TABLE_TRI7({0, 0x14, 0x16, 0x72, 0x12, 0x40, 0x7a});
|
58 | 71 | typedef FieldTri<uint8_t, 7, 1, StatTableTRI7, &SQR_TABLE_TRI7, &SQR2_TABLE_TRI7, nullptr, nullptr, nullptr, &QRT_TABLE_TRI7, IdTrans, &ID_TRANS, &ID_TRANS> FieldTri7;
|
| 72 | +#endif |
59 | 73 |
|
| 74 | +#ifndef DISABLE_FIELD_8 |
60 | 75 | // 8 bit field
|
61 | 76 | typedef RecLinTrans<uint8_t, 4, 4> StatTable8;
|
62 | 77 | constexpr StatTable8 SQR_TABLE_8({0x1, 0x4, 0x10, 0x40, 0x1b, 0x6c, 0xab, 0x9a});
|
63 | 78 | constexpr StatTable8 SQR2_TABLE_8({0x1, 0x10, 0x1b, 0xab, 0x5e, 0x97, 0xb3, 0xc5});
|
64 | 79 | constexpr StatTable8 QRT_TABLE_8({0xbc, 0x2a, 0x28, 0x86, 0x2c, 0xde, 0x8e, 0});
|
65 | 80 | typedef Field<uint8_t, 8, 27, StatTable8, &SQR_TABLE_8, &SQR2_TABLE_8, nullptr, nullptr, nullptr, &QRT_TABLE_8, IdTrans, &ID_TRANS, &ID_TRANS> Field8;
|
66 |
| - |
| 81 | +#endif |
67 | 82 | }
|
68 | 83 |
|
69 | 84 | Sketch* ConstructClMul1Byte(int bits, int implementation) {
|
70 | 85 | switch (bits) {
|
| 86 | +#ifndef DISABLE_FIELD_5 |
71 | 87 | case 5: return new SketchImpl<Field5>(implementation, 5);
|
| 88 | +#endif |
| 89 | +#ifndef DISABLE_FIELD_8 |
72 | 90 | case 8: return new SketchImpl<Field8>(implementation, 8);
|
| 91 | +#endif |
73 | 92 | }
|
74 | 93 | return nullptr;
|
75 | 94 | }
|
76 | 95 |
|
77 | 96 | Sketch* ConstructClMulTri1Byte(int bits, int implementation) {
|
78 | 97 | switch (bits) {
|
| 98 | +#ifndef DISABLE_FIELD_2 |
79 | 99 | case 2: return new SketchImpl<FieldTri2>(implementation, 2);
|
| 100 | +#endif |
| 101 | +#ifndef DISABLE_FIELD_3 |
80 | 102 | case 3: return new SketchImpl<FieldTri3>(implementation, 3);
|
| 103 | +#endif |
| 104 | +#ifndef DISABLE_FIELD_4 |
81 | 105 | case 4: return new SketchImpl<FieldTri4>(implementation, 4);
|
| 106 | +#endif |
| 107 | +#ifndef DISABLE_FIELD_5 |
82 | 108 | case 5: return new SketchImpl<FieldTri5>(implementation, 5);
|
| 109 | +#endif |
| 110 | +#ifndef DISABLE_FIELD_6 |
83 | 111 | case 6: return new SketchImpl<FieldTri6>(implementation, 6);
|
| 112 | +#endif |
| 113 | +#ifndef DISABLE_FIELD_7 |
84 | 114 | case 7: return new SketchImpl<FieldTri7>(implementation, 7);
|
| 115 | +#endif |
85 | 116 | }
|
86 | 117 | return nullptr;
|
87 | 118 | }
|
0 commit comments