libtommath/bn_s_mp_reverse.c

23 lines
442 B
C
Raw Normal View History

#include "tommath_private.h"
2019-04-12 12:56:29 +00:00
#ifdef BN_S_MP_REVERSE_C
2019-04-07 13:29:11 +00:00
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
/* SPDX-License-Identifier: Unlicense */
2003-02-28 16:08:34 +00:00
/* reverse an array, used for radix code */
2019-04-12 12:56:29 +00:00
void s_mp_reverse(unsigned char *s, int len)
2003-02-28 16:08:34 +00:00
{
2017-08-30 17:15:27 +00:00
int ix, iy;
unsigned char t;
2003-02-28 16:08:34 +00:00
2017-08-30 17:15:27 +00:00
ix = 0;
iy = len - 1;
while (ix < iy) {
t = s[ix];
s[ix] = s[iy];
s[iy] = t;
++ix;
--iy;
}
2003-02-28 16:08:34 +00:00
}
2004-10-29 22:07:18 +00:00
#endif