Skip to content

Generic implementation of XOR Linked List written in C99

License

Notifications You must be signed in to change notification settings

sleeptightAnsiC/xorll

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Generic implementation of XOR Linked List

XOR linked list is a type of data structure. It takes advantage of the bitwise XOR operation to decrease memory usage by storing the composition of both addresses in one field. The adress of next Node can be deduced during traversal by combining adressess of current and previous Nodes. reference

image

This implementation is generic by using void*. By design, almost everything is hidden inside of .c file. API-user can only access the adress of Item, nothing else.

Should build with any C/C++ compiler on any OS, but mostly tested on Linux with gcc

cc list.h list.c example.c -Wall -Werror -Wextra -std=c99 -fsanitize=address,undefined

Inspired by part of this video talking about problems with implementing such List in systems using Garbage Collection.

I wrote it because I really wanted to write something generic in C...

About

Generic implementation of XOR Linked List written in C99

Topics

Resources

License

Stars

Watchers

Forks

Languages