Personal library for C applications
Find a file
2025-08-26 14:01:26 +02:00
include/htd Add copy functionality to dynamic array 2025-04-19 20:16:00 +02:00
src/data_structure Add copy functionality to dynamic array 2025-04-19 20:16:00 +02:00
tests Add priority queue 2025-04-19 16:01:09 +02:00
.gitignore Add primitives, hash map and dynamic array 2025-04-17 09:53:37 +02:00
cmake_uninstall.cmake.in Add install and uninstall target 2025-04-17 10:01:35 +02:00
CMakeLists.txt Make available for FetchContent 2025-04-19 16:09:50 +02:00
README.md Make available for FetchContent 2025-04-19 16:09:50 +02:00

Personal library for C

Installation

This library can easily be installed using CMake and FetchContent. Add this to your CMakeLists.txt file:

include(FetchContent)

FetchContent_Declare(
  htd
  GIT_REPOSITORY https://github.com/hugomardbrink/htd.git
  GIT_TAG main 
)

FetchContent_MakeAvailable(htd)

add_executable(myapp main.c)
target_link_libraries(myapp PRIVATE htd::htd)

Features

Primitives

Use shorter more concise names for common C types.

  • i8: 8-bit signed integer
  • u8: 8-bit unsigned integer
  • i16: 16-bit signed integer
  • u16: 16-bit unsigned integer
  • i32: 32-bit signed integer
  • u32: 32-bit unsigned integer
  • i64: 64-bit signed integer
  • u64: 64-bit unsigned integer
  • f32: 32-bit floating point
  • f64: 64-bit floating point
  • usize: Unsigned integer of the same size as a pointer
  • isize: Signed integer of the same size as a pointer

Data structures

  • Dynamic array: A dynamic array that can grow and shrink in size.
  • Hash map: A hash map that uses murmur3, open addressing (double hashing) and tombstone deletion.
  • Priority queue: A priority queue that uses a binary heap, custom comparator.

Building

mkdir build
cd build
cmake ..
make

Testing

cd build
ctest

Local install

cd build
make install

Local uninstall

cd build
make uninstall