Voxia OS
v0.0.1
Hobby Project Operating System Targeting x86-64
Loading...
Searching...
No Matches
oct2bin.h
Go to the documentation of this file.
1
#ifndef __LIBK__OCT2BIN_H__
2
#define __LIBK__OCT2BIN_H__
3
4
#include <
type.h
>
5
6
__attribute__
((noinline))
static
uint64_t
7
oct2bin(
unsigned
char
*
str
,
size_t
len
) {
8
uint64_t
value
= 0;
9
10
for
(
size_t
i = 0; i <
len
; i++) {
11
unsigned
char
c = (
unsigned
char)
str
[i];
12
13
if
(c ==
'\0'
|| c ==
' '
)
14
break
;
15
16
if
(c <
'0'
|| c >
'7'
)
17
break
;
18
19
value
= (
value
<< 3) | (
uint64_t
) (c -
'0'
);
20
}
21
22
return
value
;
23
}
24
25
#endif
// __LIBK__OCT2BIN_H__
__attribute__
typedef __attribute__
Definition
msi.c:47
len
size_t len
Definition
oct2bin.h:7
value
return value
Definition
oct2bin.h:22
str
kstring str(const char *str)
type.h
uint64_t
unsigned long uint64_t
Definition
type.h:25
kernel
libk
oct2bin.h
Generated on Sat May 30 2026 11:09:57 for Voxia OS by
1.13.2