IgrOS-Kernel 0.1.34.545
Simple C++20 Kernel for i386/x86_64
Loading...
Searching...
No Matches
kLibC.cpp File Reference

Freestanding C runtime functions required by GCC/Clang. More...

#include <bit>
#include <cstddef>
Include dependency graph for kLibC.cpp:

Go to the source code of this file.

Functions

auto memset (void *dst, int val, std::size_t size) -> void *
 Fill memory with byte value.
auto memcpy (void *dst, const void *src, std::size_t size) -> void *
 Copy non-overlapping memory.
auto memmove (void *dst, const void *src, std::size_t size) -> void *
 Copy possibly overlapping memory.
auto memcmp (const void *lhs, const void *rhs, std::size_t size) -> int
 Compare memory.
auto memchr (const void *src, int val, std::size_t size) -> void *
 Find byte value in memory.
auto strlen (const char *src) -> std::size_t
 String length (std::string_view length of C string).

Detailed Description

Freestanding C runtime functions required by GCC/Clang.

Date
03 Nov 2026
Author
Igor Baklykov

Definition in file kLibC.cpp.

Macro Definition Documentation

◆ IGROS_NO_LIBCALLS

#define IGROS_NO_LIBCALLS

Definition at line 22 of file kLibC.cpp.

Function Documentation

◆ memchr()

IGROS_NO_LIBCALLS auto memchr ( const void * src,
int val,
std::size_t size )->void *

Find byte value in memory.

Parameters
srcSearched memory
valByte value (converted to unsigned char)
sizeNumber of bytes
Returns
Pointer to first matching byte, nullptr if not found

Definition at line 111 of file kLibC.cpp.

◆ memcmp()

IGROS_NO_LIBCALLS auto memcmp ( const void * lhs,
const void * rhs,
std::size_t size )->int

Compare memory.

Parameters
lhsFirst memory block
rhsSecond memory block
sizeNumber of bytes
Returns
Negative, zero or positive: first differing byte (unsigned) of lhs is less, equal or greater

Definition at line 94 of file kLibC.cpp.

◆ memcpy()

IGROS_NO_LIBCALLS auto memcpy ( void * dst,
const void * src,
std::size_t size )->void *

Copy non-overlapping memory.

Parameters
dstDestination memory
srcSource memory (must not overlap destination)
sizeNumber of bytes
Returns
dst

Definition at line 59 of file kLibC.cpp.

◆ memmove()

IGROS_NO_LIBCALLS auto memmove ( void * dst,
const void * src,
std::size_t size )->void *

Copy possibly overlapping memory.

Parameters
dstDestination memory
srcSource memory (may overlap destination)
sizeNumber of bytes
Returns
dst

Definition at line 74 of file kLibC.cpp.

◆ memset()

IGROS_NO_LIBCALLS auto memset ( void * dst,
int val,
std::size_t size )->void *

Fill memory with byte value.

Parameters
dstDestination memory
valByte value (converted to unsigned char)
sizeNumber of bytes
Returns
dst

Definition at line 45 of file kLibC.cpp.

◆ strlen()

IGROS_NO_LIBCALLS auto strlen ( const char * src) ->std::size_t

String length (std::string_view length of C string).

Parameters
srcNull-terminated string
Returns
Number of characters before terminator

Definition at line 127 of file kLibC.cpp.