bn_s_mp_reverse.c 448 B

12345678910111213141516171819202122
  1. #include "tommath_private.h"
  2. #ifdef BN_S_MP_REVERSE_C
  3. /* LibTomMath, multiple-precision integer library -- Tom St Denis */
  4. /* SPDX-License-Identifier: Unlicense */
  5. /* reverse an array, used for radix code */
  6. void s_mp_reverse(unsigned char *s, size_t len)
  7. {
  8. size_t ix, iy;
  9. unsigned char t;
  10. ix = 0u;
  11. iy = len - 1u;
  12. while (ix < iy) {
  13. t = s[ix];
  14. s[ix] = s[iy];
  15. s[iy] = t;
  16. ++ix;
  17. --iy;
  18. }
  19. }
  20. #endif