adding atoi_superscript and isdigit_superscript
This commit is contained in:
16
srcs/ft_atol_superscript.c
Normal file
16
srcs/ft_atol_superscript.c
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user