adding atoi_superscript and isdigit_superscript

This commit is contained in:
hugogogo
2026-05-06 20:02:44 +02:00
parent b64ede50af
commit f93c635234
10 changed files with 269 additions and 82 deletions

View File

@@ -0,0 +1,16 @@
#include "libft.h"
/**
* Parses a string of superscript digits into a long.
* Returns the integer value, or LONG_MAX/LONG_MIN on overflow.
*/
long ft_atol_superscript(const char *str)
{
long long result = ft_atoll_superscript(str);
if (result > LONG_MAX)
return LONG_MAX;
if (result < LONG_MIN)
return LONG_MIN;
return (long)result;
}