16 lines
363 B
C
16 lines
363 B
C
|
|
#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;
|
|
} |