tgrekov-fdf
HIVE fdf May 2024
Loading...
Searching...
No Matches
u_len_base.c
1
/* ************************************************************************** */
2
/* */
3
/* ::: :::::::: */
4
/* u_len_base.c :+: :+: :+: */
5
/* +:+ +:+ +:+ */
6
/* By: tgrekov <tgrekov@student.hive.fi> +#+ +:+ +#+ */
7
/* +#+#+#+#+#+ +#+ */
8
/* Created: 2023/12/16 17:31:15 by tgrekov #+# #+# */
9
/* Updated: 2024/02/02 04:17:52 by tgrekov ### ########.fr */
10
/* */
11
/* ************************************************************************** */
12
13
#include "internal_types.h"
14
15
int
u_len_base
(
t_ubiggest
n,
int
base)
16
{
17
int
len;
18
19
len = 0;
20
if
(n == 0)
21
len++;
22
while
(n)
23
{
24
n /= base;
25
len++;
26
}
27
return
(len);
28
}
t_ubiggest
unsigned long long t_ubiggest
Convenience typedef for largest unsigned type I need to handle.
Definition
internal_types.h:34
u_len_base
int u_len_base(t_ubiggest n, int base)
Determine the length of unsigned number n in base base.
Definition
u_len_base.c:29
deps
libft
ft_printf
srcs
mandatory
utils
u_len_base.c