Skip to content

Skyb0rg007/Amlib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Amlib

General purpose C library, providing portable and efficient utilities

Contents

  • Data Structures
    • List-like
      • <am/data/list.h>
        • Intrusive, doubly-linked, circular linked list
      • <am/data/hlist.h>
        • Intrusive, doubly-linked, non-circular linked list
        • Mainly used for implementing the hashtable
    • Hashtable
      • <am/data/hashtable>
        • Intrusive, constant-sized, chaining hashtable
        • Great when the number of elements is estimatable
        • Fnva1-hash and Murmurhash are available in am/data/hash.h
    • Concurrent
      • <am/concurrent/ring_buffer>
        • Lock-free implementation from ConcurrencyKit
        • Provides optimized functions for single-consumer, single-producer work
        • Barebones functions designed for wrapping
  • Portable utilities
    • Atomics (<am/atomic.h>)
      • Provides atomics in an ANSI-compliant manner, modeled after C11 atomics
      • Implementations for C11, GCC, and MSVC
    • Threads (<am/threads.h>)
      • Provides threads, mutexes, spinlocks, condition variables, once flags
      • Modeled after C11 threads
      • Implementations for pthreads, Win32, c11 threads
    • Function attributes + more (<am/macros.h>)
      • Generally useful macro utilities, such as static assertions and _Pragma
      • Portable inline and restrict, and type-safe container_of (if possible)
      • ANSI-compliant alternatives are available for all utilities
  • Programming utilities
    • Allocators (<am/alloc.h>)
      • Stack allocators, free-list allocators, concurrent allocators, aligned allocators
      • API that allows for efficient swapping out of different allocators within user data structures
    • Structured logging
      • Logging API modeled after glib's structured logging facitilies
      • Allows for programs to filter logs from libraries without recompilation
      • Threadsafe logging
      • Provided log writers for standard FILE streams as well as journald

Target Platforms

  • x86_64 Linux
  • x86_32 Linux
  • Windows (Mingw64)
  • Windows (MSVC)
  • OSX (clang)
  • Emscripten
  • Android
  • iOS

Building

CMake

$ mkdir _build
$ cd _build
$ cmake .. \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr/local \
    -G "Unix Makefiles" \
    -DBUILD_TESTING=ON \
    -DBUILD_SHARED=ON
$ cmake --build . --target am
$ cmake --build . --target install

CMake Options

  • CMAKE_BUILD_TYPE
    • Controls compiler optimization options
    • Debug, Release, RelWithDebInfo, MinSizeRel
  • CMAKE_INSTALL_PREFIX
    • Controls where to install the library
  • BUILD_TESTING
    • Controls whether or not to build tests (default: ON)
  • BUILD_SHARED
    • Controls whether Amlib is built as a shared library (default: ON)

About

Portable C utilities

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published