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