Merge pull request #578 from PX4/fix_mp_prime_strong_lucas_lefridge_compilation
[libtommath.git] / mp_error_to_string.c
blob39adcd124886bd41d08dd5617716e88f1ebfa395
1 #include "tommath_private.h"
2 #ifdef MP_ERROR_TO_STRING_C
3 /* LibTomMath, multiple-precision integer library -- Tom St Denis */
4 /* SPDX-License-Identifier: Unlicense */
6 /* return a char * string for a given code */
7 const char *mp_error_to_string(mp_err code)
9 switch (code) {
10 case MP_OKAY:
11 return "Successful";
12 case MP_ERR:
13 return "Unknown error";
14 case MP_MEM:
15 return "Out of heap";
16 case MP_VAL:
17 return "Value out of range";
18 case MP_ITER:
19 return "Max. iterations reached";
20 case MP_BUF:
21 return "Buffer overflow";
22 case MP_OVF:
23 return "Integer overflow";
24 default:
25 return "Invalid error code";
29 #endif