@@ -38,83 +38,36 @@ namespace quadiron {
3838namespace gf {
3939
4040template <>
41- void RingModN<uint16_t >::neg(size_t n, uint16_t * x ) const
41+ void RingModN<uint16_t >::neg(vec::Buffers< uint16_t >& buf, size_t buf_id ) const
4242{
43- simd::neg (n, x , this ->_card );
43+ simd::neg (* this , buf, buf_id , this ->_card );
4444}
4545
4646template <>
47- void RingModN<uint32_t >::neg(size_t n, uint32_t * x ) const
47+ void RingModN<uint32_t >::neg(vec::Buffers< uint32_t >& buf, size_t buf_id ) const
4848{
49- simd::neg (n, x, this ->_card );
50- }
51-
52- template <>
53- void RingModN<uint32_t >::mul_coef_to_buf(
54- uint32_t a,
55- uint32_t * src,
56- uint32_t * dest,
57- size_t len) const
58- {
59- simd::mul_coef_to_buf (a, src, dest, len, this ->_card );
60- }
61-
62- template <>
63- void RingModN<uint32_t >::add_two_bufs(uint32_t * src, uint32_t * dest, size_t len)
64- const
65- {
66- simd::add_two_bufs (src, dest, len, this ->_card );
67- }
68-
69- template <>
70- void RingModN<uint32_t >::sub_two_bufs(
71- uint32_t * bufa,
72- uint32_t * bufb,
73- uint32_t * res,
74- size_t len) const
75- {
76- simd::sub_two_bufs (bufa, bufb, res, len, this ->_card );
49+ simd::neg (*this , buf, buf_id, this ->_card );
7750}
7851
52+ // @note We specialize the function for the case Buffers having meta
7953template <>
8054void RingModN<uint16_t >::mul_coef_to_buf(
81- uint16_t a ,
82- uint16_t * src,
83- uint16_t * dest,
84- size_t len ) const
55+ uint16_t coef ,
56+ vec::Buffers< uint16_t >& src,
57+ vec::Buffers< uint16_t >& dest,
58+ size_t buf_id ) const
8559{
86- simd::mul_coef_to_buf (a, src, dest, len , this ->_card );
60+ simd::mul_coef_to_buf (* this , coef, src, dest, buf_id , this ->_card );
8761}
8862
8963template <>
90- void RingModN<uint16_t >::add_two_bufs(uint16_t * src, uint16_t * dest, size_t len)
91- const
92- {
93- simd::add_two_bufs (src, dest, len, this ->_card );
94- }
95-
96- template <>
97- void RingModN<uint16_t >::sub_two_bufs(
98- uint16_t * bufa,
99- uint16_t * bufb,
100- uint16_t * res,
101- size_t len) const
102- {
103- simd::sub_two_bufs (bufa, bufb, res, len, this ->_card );
104- }
105-
106- template <>
107- void RingModN<uint16_t >::hadamard_mul(int n, uint16_t * x_u16, uint16_t * y_u16)
108- const
109- {
110- simd::mul_two_bufs (y_u16, x_u16, n, this ->_card );
111- }
112-
113- template <>
114- void RingModN<uint32_t >::hadamard_mul(int n, uint32_t * x_u32, uint32_t * y_u32)
115- const
64+ void RingModN<uint32_t >::mul_coef_to_buf(
65+ uint32_t coef,
66+ vec::Buffers<uint32_t >& src,
67+ vec::Buffers<uint32_t >& dest,
68+ size_t buf_id) const
11669{
117- simd::mul_two_bufs (y_u32, x_u32, n , this ->_card );
70+ simd::mul_coef_to_buf (* this , coef, src, dest, buf_id , this ->_card );
11871}
11972
12073} // namespace gf
0 commit comments