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 an int.
* Returns the integer value, or INT_MAX/INT_MIN on overflow.
*/
int ft_atoi_superscript(const char *str)
{
long long result = ft_atoll_superscript(str);
if (result > INT_MAX)
return INT_MAX;
if (result < INT_MIN)
return INT_MIN;
return (int)result;
}