coastline 0.0.4
Loading...
Searching...
No Matches
os_libc.h File Reference

The memory and formatting routines libultra provides in place of a C library. More...

#include <stddef.h>
#include <PR/ultratypes.h>
Include dependency graph for os_libc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ldiv_t
 The quotient and remainder of ldiv(). More...
struct  lldiv_t
 The quotient and remainder of lldiv(). More...

Functions

void * bcopy (const void *src, void *dst, int n)
 Copy n bytes between buffers that may overlap.
int bcmp (const void *a, const void *b, int n)
 Compare n bytes of two buffers.
void bzero (void *p, int n)
 Clear n bytes.
void * memcpy (void *dst, const void *src, size_t n)
 Copy n bytes between buffers that do not overlap.
size_t strlen (const char *s)
 Return the length of a string.
const char * strchr (const char *s, int c)
 Find the first occurrence of a character in a string.
int sprintf (char *dst, const char *fmt,...)
 Format into a buffer.
ldiv_t ldiv (long num, long denom)
 Divide, truncating towards zero.
lldiv_t lldiv (long long num, long long denom)
 Divide 64-bit values, truncating towards zero.

Detailed Description

The memory and formatting routines libultra provides in place of a C library.

Function Documentation

◆ bcopy()

void * bcopy ( const void * src,
void * dst,
int n )

Copy n bytes between buffers that may overlap.

Parameters
srcThe buffer to copy from.
dstThe buffer to copy to.
nThe count of bytes.
Returns
dst.
Ghidra address:
USA: 0x802674d0
Ghidra address:
Asia: 0x80267020
Ghidra address:
EUR: 0x80268cc0
Ghidra address:
JPN: 0x80268770

◆ bcmp()

int bcmp ( const void * a,
const void * b,
int n )

Compare n bytes of two buffers.

Parameters
aThe first buffer.
bThe second buffer.
nThe count of bytes to compare.
Returns
0 when they are equal, and nonzero otherwise.
Ghidra address:
USA: 0x80262540
Ghidra address:
Asia: 0x80262090
Ghidra address:
EUR: 0x80263cc0
Ghidra address:
JPN: 0x80263760

◆ bzero()

void bzero ( void * p,
int n )

Clear n bytes.

Parameters
pThe buffer to clear.
nThe count of bytes to clear.
Ghidra address:
USA: 0x8026bba0
Ghidra address:
Asia: 0x8026B6F0
Ghidra address:
EUR: 0x8026db70
Ghidra address:
JPN: 0x8026d620

◆ memcpy()

void * memcpy ( void * dst,
const void * src,
size_t n )

Copy n bytes between buffers that do not overlap.

Parameters
dstThe buffer to copy to.
srcThe buffer to copy from.
nThe count of bytes.
Returns
dst.
Ghidra address:
USA: 0x80260b20
Ghidra address:
Asia: 0x80260670
Ghidra address:
EUR: 0x80261fb0
Ghidra address:
JPN: 0x80261a60

◆ strlen()

size_t strlen ( const char * s)

Return the length of a string.

Parameters
sThe NUL-terminated string.
Returns
The count of characters before the terminating NUL.
Ghidra address:
USA: 0x80260b4c
Ghidra address:
Asia: 0x8026069C
Ghidra address:
EUR: 0x80261fdc
Ghidra address:
JPN: 0x80261a8c

◆ strchr()

const char * strchr ( const char * s,
int c )

Find the first occurrence of a character in a string.

Parameters
sThe NUL-terminated string.
cThe character to find, converted to char.
Returns
The occurrence, or NULL when the character is absent from the string.
Ghidra address:
USA: 0x80260b74
Ghidra address:
Asia: 0x802606C4
Ghidra address:
EUR: 0x80262004
Ghidra address:
JPN: 0x80261ab4

◆ sprintf()

int sprintf ( char * dst,
const char * fmt,
... )

Format into a buffer.

Parameters
dstThe buffer written, NUL-terminated and large enough for the output.
fmtThe printf format, followed by its arguments.
Returns
The number of characters written, not counting the terminating NUL.
Ghidra address:
USA: 0x80260dd4
Ghidra address:
Asia: 0x80260924
Ghidra address:
EUR: 0x80262264
Ghidra address:
JPN: 0x80261d14

◆ ldiv()

ldiv_t ldiv ( long num,
long denom )

Divide, truncating towards zero.

Parameters
numThe dividend.
denomThe divisor, not 0.
Returns
The quotient and the remainder, the remainder with the sign of the dividend.
Ghidra address:
USA: 0x8026e970
Ghidra address:
Asia: 0x8026E4C0
Ghidra address:
EUR: 0x80270940
Ghidra address:
JPN: 0x802703f0

◆ lldiv()

lldiv_t lldiv ( long long num,
long long denom )

Divide 64-bit values, truncating towards zero.

Parameters
numThe dividend.
denomThe divisor, not 0.
Returns
The quotient and the remainder, the remainder with the sign of the dividend.
Ghidra address:
USA: 0x8026e870
Ghidra address:
Asia: 0x8026E3C0
Ghidra address:
EUR: 0x80270840
Ghidra address:
JPN: 0x802702f0