Skip to content

Instantly share code, notes, and snippets.

View tekladis's full-sized avatar

Justin Kinnaird tekladis

  • 06:48 (UTC -05:00)
View GitHub Profile
@tekladis
tekladis / vecdecomp.cxx
Created July 8, 2017 15:40
Simple ZLib function for C++
/*
Uses vectors for both input and output... Just a reminder to myself of how to use zlib properly in the future.
*/
static inline long int decompress(std::vector<uint8_t>& in, std::vector<uint8_t> &out)
{
auto ret = Z_OK;
const size_t BUFSIZE = 1024 * 64;
uint8_t chunk[BUFSIZE];
z_stream zs = {Z_NULL};
zs.next_in = in.data();
@tekladis
tekladis / arraymap.c
Last active April 21, 2017 06:17
Associative array map implementation in C, for small data sets
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// Our array entry structure
typedef struct arraymap_entry_t {
char *key;
char *value;
uint_fast32_t key_hash;