-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_intmaxlen_base.c
executable file
·29 lines (26 loc) · 1.14 KB
/
ft_intmaxlen_base.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_intmaxlen_base.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: akharrou <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/04/17 01:54:03 by akharrou #+# #+# */
/* Updated: 2019/04/18 19:24:52 by akharrou ### ########.fr */
/* */
/* ************************************************************************** */
#include "../Includes/stdlib_42.h"
#include "../Includes/string_42.h"
size_t ft_intmaxlen_base(intmax_t n, unsigned int base)
{
intmax_t num;
size_t length;
length = 1;
num = (n < 0) ? -n : n;
while (num >= base)
{
num /= base;
++length;
}
return (length);
}