Turnstone Operating System
Loading...
Searching...
No Matches
utils.xx.c File Reference

several utility functions implementation. More...

#include <utils.h>
#include <memory.h>
#include <strings.h>
#include <random.h>

Functions

 MODULE ("turnstone.lib.utils")
 
number_t power (number_t base, number_t p)
 power base with p More...
 
int8_t ito_base_with_buffer (char_t *buffer, number_t number, number_t base)
 converts integer to string More...
 
int8_t uto_base_with_buffer (char_t *buffer, unumber_t number, number_t base)
 converts unsigned integer to string More...
 
int8_t fto_base_with_buffer (char_t *buffer, float64_t number, number_t prec, number_t base)
 converts float to string More...
 
uint8_t byte_count (const uint64_t num)
 
uint64_t read_memio (uint64_t va, uint8_t size)
 
void write_memio (uint64_t va, uint64_t val, uint8_t size)
 
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 isprint (char_t c)
 
boolean_t isgraph (char_t c)
 
boolean_t iscntrl (char_t c)
 
boolean_t ispunct (char_t c)
 
boolean_t isblank (char_t c)
 
boolean_t isascii (char_t c)
 
boolean_t isalnumw (char_t c)
 
const char_trandstr (uint32_t len)
 

Detailed Description

several utility functions implementation.

This work is licensed under TURNSTONE OS Public License. Please read and understand latest version of Licence.

Function Documentation

◆ fto_base_with_buffer()

int8_t fto_base_with_buffer ( char_t buffer,
float64_t  number,
number_t  prec,
number_t  base 
)

converts float to string

Parameters
[in]bufferdestination buffer
[in]numberto convert
[in]baseto convert
Returns
0 if successed

buffer should be enough to take data. it's malloc free

◆ ito_base_with_buffer()

int8_t ito_base_with_buffer ( char_t buffer,
number_t  number,
number_t  base 
)

converts integer to string

Parameters
[in]bufferdestination buffer
[in]numberto convert
[in]baseto convert
Returns
0 if successed

buffer should be enough to take data. it's malloc free

◆ power()

number_t power ( number_t  base,
number_t  p 
)

power base with p

Parameters
[in]basethe base
[in]pthe power
Returns
base^p with fast power algorithm

◆ uto_base_with_buffer()

int8_t uto_base_with_buffer ( char_t buffer,
unumber_t  number,
number_t  base 
)

converts unsigned integer to string

Parameters
[in]bufferdestination buffer
[in]numberunsigned number to convert
[in]baseto convert
Returns
0 if successed

buffer should be enough to take data. it's malloc free