t7x/deps/libtommath/s_mp_warray_get.c

19 lines
463 B
C
Raw Permalink Normal View History

2024-06-17 19:04:36 -04:00
#include "tommath_private.h"
#ifdef S_MP_WARRAY_GET_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
/* SPDX-License-Identifier: Unlicense */
void *s_mp_warray_get(void)
{
if (s_mp_warray.w_used)
return NULL;
if (s_mp_warray.w_free == NULL) {
s_mp_warray.w_free = MP_CALLOC(MP_WARRAY, sizeof(mp_word));
}
s_mp_warray.w_used = s_mp_warray.w_free;
s_mp_warray.w_free = NULL;
return s_mp_warray.w_used;
}
#endif