Skip to content

Commit

Permalink
vect.c: declare masked one-liners inline.
Browse files Browse the repository at this point in the history
  • Loading branch information
dot-asm committed Oct 11, 2020
1 parent 07e5e3f commit 414ac6b
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions src/vect.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,21 @@
*/

#ifdef lshift_mod_384
void lshift_mod_384(vec384 ret, const vec384 a, size_t n, const vec384 mod)
inline void lshift_mod_384(vec384 ret, const vec384 a, size_t n,
const vec384 mod)
{
while(n--)
add_mod_384(ret, a, a, mod), a = ret;
}
#endif

#ifdef mul_by_8_mod_384
void mul_by_8_mod_384(vec384 ret, const vec384 a, const vec384 mod)
inline void mul_by_8_mod_384(vec384 ret, const vec384 a, const vec384 mod)
{ lshift_mod_384(ret, a, 3, mod); }
#endif

#ifdef mul_by_3_mod_384
void mul_by_3_mod_384(vec384 ret, const vec384 a, const vec384 mod)
inline void mul_by_3_mod_384(vec384 ret, const vec384 a, const vec384 mod)
{
vec384 t;

Expand All @@ -37,23 +38,24 @@ void mul_by_3_mod_384(vec384 ret, const vec384 a, const vec384 mod)
#endif

#ifdef mul_by_3_mod_384x
void mul_by_3_mod_384x(vec384x ret, const vec384x a, const vec384 mod)
inline void mul_by_3_mod_384x(vec384x ret, const vec384x a, const vec384 mod)
{
mul_by_3_mod_384(ret[0], a[0], mod);
mul_by_3_mod_384(ret[1], a[1], mod);
}
#endif

#ifdef mul_by_8_mod_384x
void mul_by_8_mod_384x(vec384x ret, const vec384x a, const vec384 mod)
inline void mul_by_8_mod_384x(vec384x ret, const vec384x a, const vec384 mod)
{
mul_by_8_mod_384(ret[0], a[0], mod);
mul_by_8_mod_384(ret[1], a[1], mod);
}
#endif

#ifdef mul_by_1_plus_i_mod_384x
void mul_by_1_plus_i_mod_384x(vec384x ret, const vec384x a, const vec384 mod)
inline void mul_by_1_plus_i_mod_384x(vec384x ret, const vec384x a,
const vec384 mod)
{
vec384 t;

Expand All @@ -64,28 +66,29 @@ void mul_by_1_plus_i_mod_384x(vec384x ret, const vec384x a, const vec384 mod)
#endif

#ifdef add_mod_384x
void add_mod_384x(vec384x ret, const vec384x a, const vec384x b,
const vec384 mod)
inline void add_mod_384x(vec384x ret, const vec384x a, const vec384x b,
const vec384 mod)
{
add_mod_384(ret[0], a[0], b[0], mod);
add_mod_384(ret[1], a[1], b[1], mod);
}
#endif

#ifdef sub_mod_384x
void sub_mod_384x(vec384x ret, const vec384x a, const vec384x b,
const vec384 mod)
inline void sub_mod_384x(vec384x ret, const vec384x a, const vec384x b,
const vec384 mod)
{
sub_mod_384(ret[0], a[0], b[0], mod);
sub_mod_384(ret[1], a[1], b[1], mod);
}
#endif

#ifdef lshift_mod_384x
void lshift_mod_384x(vec384x ret, const vec384x a, size_t n, const vec384 p)
inline void lshift_mod_384x(vec384x ret, const vec384x a, size_t n,
const vec384 mod)
{
lshift_mod_384(ret[0], a[0], n, p);
lshift_mod_384(ret[1], a[1], n, p);
lshift_mod_384(ret[0], a[0], n, mod);
lshift_mod_384(ret[1], a[1], n, mod);
}
#endif

Expand Down

0 comments on commit 414ac6b

Please sign in to comment.