#include "utils.h"
#include <stddef.h>
#include <stdint.h>
Functions
Rounds the given value to the nearest 4 (for alignment).
More...
Rounds the given value to the nearest 8 (for alignment).
More...
Replacement for standard strlen.
More...
Replacement for standard strcmp.
More...
int32_t
yami_strncmp (const char s1[], const char s2[], const size_t n)
Replacement for standard strncmp.
More...
void
yami_strncpy (char dest[], const char src[], const size_t n)
Replacement for standard strncpy.
More...
int32_t
yami_strfind (const char s[], const char c, const size_t from, const size_t to)
Finds the given character in nul-terminated string.
More...
void
yami_memcpy (uint8_t dest[], const size_t dest_from, const uint8_t src[], const size_t src_from, const size_t n)
Replacement for standard memcpy.
More...
Replacement for standard bzero.
More...
Converts uint32_t to string format.
More...
int32_t
yami_string_to_uint32 (const char buf[], const size_t from, const size_t to, uint32_t *const out_value)
Converts nul-terminated string to uint32_t.
More...
int32_t
yami_string_to_uint8 (const char buf[], const size_t from, const size_t to, uint8_t *const out_value)
Converts nul-terminated string to uint8_t.
More...
Function Documentation
void yami_bzero
(
uint8_t
dest[],
const size_t
n
)
Replacement for standard bzero.
void yami_memcpy
(
uint8_t
dest[],
const size_t
dest_from,
const uint8_t
src[],
const size_t
src_from,
const size_t
n
)
Replacement for standard memcpy.
size_t yami_round_up_to_4
(
size_t
v )
Rounds the given value to the nearest 4 (for alignment).
- Parameters
-
v value to round
- Returns
- value rounded up to the nearset 4 boundary
size_t yami_round_up_to_8
(
size_t
v )
Rounds the given value to the nearest 8 (for alignment).
- Parameters
-
v value to round
- Returns
- value rounded up to the nearset 8 boundary
int32_t yami_strcmp
(
const char
s1[],
const char
s2[]
)
Replacement for standard strcmp.
int32_t yami_strfind
(
const char
s[],
char
c,
size_t
from,
size_t
to
)
Finds the given character in nul-terminated string.
- Parameters
-
s string to be searched in
c character to be searched for
from starting index in s
to last (not inclusive) index in s
- Returns
- index or -1 if the given character is not found.
int32_t yami_string_to_uint32
(
const char
buf[],
size_t
from,
size_t
to,
uint32_t *
out_value
)
Converts nul-terminated string to uint32_t.
- Parameters
-
buf string to be converted
from starting index in buf
to last (not inclusive) index in buf
out_value value after conversion
- Returns
- 1 on success or 0 if the given string cannot be converted to number
int32_t yami_string_to_uint8
(
const char
buf[],
size_t
from,
size_t
to,
uint8_t *
out_value
)
Converts nul-terminated string to uint8_t.
- Parameters
-
buf string to be converted
from starting index in buf
to last (not inclusive) index in buf
out_value value after conversion
- Returns
- 1 on success or 0 if the given string cannot be converted to number
size_t yami_strlen
(
const char
s[] )
Replacement for standard strlen.
int32_t yami_strncmp
(
const char
s1[],
const char
s2[],
const size_t
n
)
Replacement for standard strncmp.
void yami_strncpy
(
char
dest[],
const char
src[],
const size_t
n
)
Replacement for standard strncpy.
int32_t yami_uint32_to_string
(
uint32_t
v,
char
buf[],
size_t
buf_from,
size_t
buf_size
)
Converts uint32_t to string format.
- Parameters
-
v value to be converted
buf buffer where the string will be formatted
buf_from starting index in buf
buf_size total size of buf
- Returns
- index of last character in buf or -1 if buf_size is not big enough