2018-05-02 19:43:17 +00:00
|
|
|
#include "tommath_private.h"
|
2019-10-19 14:24:39 +00:00
|
|
|
#ifdef MP_ERROR_TO_STRING_C
|
2019-04-07 13:29:11 +00:00
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
|
|
|
|
/* SPDX-License-Identifier: Unlicense */
|
2003-08-05 01:24:44 +00:00
|
|
|
|
|
|
|
/* return a char * string for a given code */
|
2019-05-12 22:22:18 +00:00
|
|
|
const char *mp_error_to_string(mp_err code)
|
2003-08-05 01:24:44 +00:00
|
|
|
{
|
2019-04-12 09:24:17 +00:00
|
|
|
switch (code) {
|
|
|
|
case MP_OKAY:
|
|
|
|
return "Successful";
|
2019-05-09 02:16:24 +00:00
|
|
|
case MP_ERR:
|
|
|
|
return "Unknown error";
|
2019-04-12 09:24:17 +00:00
|
|
|
case MP_MEM:
|
|
|
|
return "Out of heap";
|
|
|
|
case MP_VAL:
|
|
|
|
return "Value out of range";
|
|
|
|
case MP_ITER:
|
|
|
|
return "Max. iterations reached";
|
2019-10-20 14:37:46 +00:00
|
|
|
case MP_BUF:
|
|
|
|
return "Buffer overflow";
|
2019-04-12 09:24:17 +00:00
|
|
|
default:
|
|
|
|
return "Invalid error code";
|
2003-08-05 01:24:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|