Turnstone Operating System
|
util functions and macros More...
#include <types.h>
Macros | |
#define | ___UTILS_H 0 |
#define | ARRAY_SIZE(x) |
#define | MIN(x, y) |
#define | MAX(x, y) |
#define | ABS(x) |
#define | sizeof_field(s, m) |
#define | typeof_field(s, m) |
#define | offsetof_field(s, m) |
#define | itoa_with_buffer(buf, number) |
#define | utoa_with_buffer(buf, number) |
#define | utoh_with_buffer(buf, number) |
#define | ftoa_with_buffer(buf, number) |
#define | ftoh_with_buffer(buf, number) |
#define | ftoa_with_buffer_and_prec(buf, number, prec) |
#define | ftoh_with_buffer_and_prec(buf, number, prec) |
#define | BYTE_SWAP16(n) |
#define | BYTE_SWAP32(n) |
#define | BYTE_SWAP64(n) |
#define | DIGIT_TO_HEX(r) |
#define | ROTLEFT(a, b, c) |
#define | ROTRIGHT(a, b, c) |
#define | ROTLEFT8(a, b) |
#define | ROTRIGHT8(a, b) |
#define | ROTLEFT16(a, b) |
#define | ROTRIGHT16(a, b) |
#define | ROTLEFT32(a, b) |
#define | ROTRIGHT32(a, b) |
#define | ROTLEFT64(a, b) |
#define | ROTRIGHT64(a, b) |
Functions | |
number_t | power (number_t base, number_t p) |
power base with p | |
int8_t | ito_base_with_buffer (char_t *buffer, number_t number, number_t base) |
converts integer to string | |
int8_t | uto_base_with_buffer (char_t *buffer, unumber_t number, number_t base) |
converts unsigned integer to string | |
int8_t | fto_base_with_buffer (char_t *buffer, float64_t number, number_t prec, number_t base) |
converts float to string | |
static uint64_t | byte_swap (uint64_t num, uint8_t bc) |
uint8_t | byte_count (const uint64_t num) |
static boolean_t | bit_test32 (uint32_t *data, uint8_t bitloc) |
test bit value of given data at bitloc | |
static boolean_t | bit_clear32 (volatile uint32_t *data, uint8_t bitloc) |
clears bit value of given data at bitloc | |
static boolean_t | bit_set32 (volatile uint32_t *data, uint8_t bitloc) |
sets bit value of given data at bitloc | |
static boolean_t | bit_test (uint64_t *data, uint8_t bitloc) |
test bit value of given data at bitloc | |
static boolean_t | bit_clear (uint64_t *data, uint8_t bitloc) |
clears bit value of given data at bitloc | |
static boolean_t | bit_set (uint64_t *data, uint8_t bitloc) |
sets bit value of given data at bitloc | |
static boolean_t | bit_locked_set (volatile uint64_t *data, uint64_t bitloc) |
sets bit value of given data at bitloc with lock prefix | |
static boolean_t | bit_change (uint64_t *data, uint8_t bitloc) |
changes bit value of given data at bitloc | |
static uint64_t | bit_most_significant (uint64_t num) |
gets most significant bit location | |
uint64_t | read_memio (uint64_t va, uint8_t size) |
void | write_memio (uint64_t va, uint64_t val, uint8_t size) |
static uint64_t | reverse_bits (uint64_t bits, uint8_t bit_count) |
boolean_t | isalpha (char_t c) |
boolean_t | isdigit (char_t c) |
boolean_t | isalnum (char_t c) |
boolean_t | isxdigit (char_t c) |
boolean_t | islower (char_t c) |
boolean_t | isupper (char_t c) |
boolean_t | isspace (char_t c) |
boolean_t | ispunct (char_t c) |
boolean_t | isprint (char_t c) |
boolean_t | isgraph (char_t c) |
boolean_t | iscntrl (char_t c) |
boolean_t | isblank (char_t c) |
boolean_t | isascii (char_t c) |
boolean_t | isalnumw (char_t c) |
const char_t * | randstr (uint32_t len) |
static boolean_t | find_lsb (uint64_t search, uint64_t *location) |
util functions and macros
This work is licensed under TURNSTONE OS Public License. Please read and understand latest version of Licence.
#define ___UTILS_H 0 |
prevent duplicate header error macro
#define ABS | ( | x | ) |
#define ARRAY_SIZE | ( | x | ) |
#define BYTE_SWAP16 | ( | n | ) |
#define BYTE_SWAP32 | ( | n | ) |
#define BYTE_SWAP64 | ( | n | ) |
#define DIGIT_TO_HEX | ( | r | ) |
#define ftoa_with_buffer | ( | buf, | |
number ) |
#define ftoa_with_buffer_and_prec | ( | buf, | |
number, | |||
prec ) |
#define ftoh_with_buffer | ( | buf, | |
number ) |
#define ftoh_with_buffer_and_prec | ( | buf, | |
number, | |||
prec ) |
#define itoa_with_buffer | ( | buf, | |
number ) |
#define MAX | ( | x, | |
y ) |
find max of two numbers
[in] | x | first number |
[in] | y | first number |
#define MIN | ( | x, | |
y ) |
find min of two numbers
[in] | x | first number |
[in] | y | first number |
#define offsetof_field | ( | s, | |
m ) |
#define ROTLEFT | ( | a, | |
b, | |||
c ) |
#define ROTLEFT16 | ( | a, | |
b ) |
#define ROTLEFT32 | ( | a, | |
b ) |
#define ROTLEFT8 | ( | a, | |
b ) |
#define ROTRIGHT | ( | a, | |
b, | |||
c ) |
#define ROTRIGHT16 | ( | a, | |
b ) |
#define ROTRIGHT32 | ( | a, | |
b ) |
#define ROTRIGHT8 | ( | a, | |
b ) |
#define sizeof_field | ( | s, | |
m ) |
#define typeof_field | ( | s, | |
m ) |
#define utoa_with_buffer | ( | buf, | |
number ) |
#define utoh_with_buffer | ( | buf, | |
number ) |
changes bit value of given data at bitloc
[in] | data | bit array |
[in] | bitloc | bit location at data |
clears bit value of given data at bitloc
[in] | data | bit array |
[in] | bitloc | bit location at data |
clears bit value of given data at bitloc
[in] | data | bit array |
[in] | bitloc | bit location at data |
sets bit value of given data at bitloc with lock prefix
[in] | data | bit array |
[in] | bitloc | bit location at data |
gets most significant bit location
[in] | num | number to get |
sets bit value of given data at bitloc
[in] | data | bit array |
[in] | bitloc | bit location at data |
sets bit value of given data at bitloc
[in] | data | bit array |
[in] | bitloc | bit location at data |
test bit value of given data at bitloc
[in] | data | bit array |
[in] | bitloc | bit location at data |
test bit value of given data at bitloc
[in] | data | bit array |
[in] | bitloc | bit location at data |
converts float to string
[in] | buffer | destination buffer |
[in] | number | to convert |
[in] | base | to convert |
buffer should be enough to take data. it's malloc free
converts integer to string
[in] | buffer | destination buffer |
[in] | number | to convert |
[in] | base | to convert |
buffer should be enough to take data. it's malloc free
power base with p
[in] | base | the base |
[in] | p | the power |