Skip to content

takev/libtvutils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Take Vos's Library of useful utilities.

This library will grow as I add new utilities which will not fit in another
library. This started with the libraries like libuniqueid and libmarshall
which included things that really didn't fit and overlap.

Atomic operations
-----------------
Atomic operations can be found in the atomic_gcc.h header file. atomic.h will
include this or another platform's implementation. These functions are atomic
operations which are platform independed. Currently
only gcc/llvm intrinsics are used, OS X used to have different operations for this.

For easy of use and compatibility these operations are made for each data type.
16, 32, 64 bits; signed and unsigned integers.

Time manipulation
-----------------
The time manipulation functions can be found in time_posix1993.h or time_bsd.h
which are included from time.h. For easy time delta calculations time is stored
as a 64 bit 32.32 fixed point; the number of seconds since January 1st 2012.
Simple add and subtract operation on the 64 bit signed integer yield the correct
result. The value of 1 in this integer means 1/(2^32) seconds.

Endian swapping
---------------
There seem to be no standard for endian swapping; it is different for bsd, Linux
Windows, etc. The endian swapping in socket.h does not have a 64 bit variant.
The functions in endian.h can handle swapping from and to host native to and from
big endian and little endian for 8, 16, 32 and 64 bit signed and unsigned integers.

Memory access
-------------
Taking an integer or float value from a byte array has pitfalls. The memory_access.h
file tries to solve most problems, including big- and little-endian conversion,
aligned or unaligned memory access and strict aliasing.

Standard float
--------------
stdfloat.h just defines float32_t and float64_t to mirror what has been done for
the explicit integer definitions in stdint.h

Integer utilities
-----------------
integer.h Includes a collection of functions operating on integers.

Ring buffer
-----------
A lock free ring buffer that can be shared between threads/processes. The ring buffer
works very much like a message queue with variable sized messages. Access to the
ring buffer is done directly through pointers into the memory of the ring buffer.
Direct access is fast with the least number of copies needing to be made.

Dynamic arguments
-----------------
Functions to build a va_list from scratch.

Base64 / Base85
---------------
Function to display a int64 in base85, in 10 characters.

Binary search
-------------
A binary search which also find the nearest-lower value.

Buffer
------
A buffer object, which contains the pointer to data, the size of the data, and
the offset into the data.

Daemon
------
Create a daemon process, and manage a pid file correctly, including locking.

About

Take Vos's Library of useful utilities

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published