This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// very simple circular buffer | |
// - rlyeh, public domain | |
#include <vector> | |
template<typename T, unsigned N> | |
struct circ { | |
static_assert( ((N != 0) && !(N & (N - 1))), "\n\n" | |
"N should be power of two because:\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Manager to track and record all live instances of any trackable class, | |
* thru trackable<class>::begin()/end() iterators. | |
* Copyright (c) 2011-2015 Mario 'rlyeh' Rodriguez. | |
* zlib/libpng licensed. | |
* Usage: | |
* | |
* Always derive from trackable<T> first. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
P-code for PL/0 machine | |
[ref] https://en.wikipedia.org/wiki/P-code_machine | |
[ref] http://blackmesatech.com/2011/12/pl0/pl0.xhtml | |
The PL/0 virtual machine was originally specified by Nicklaus Wirth in his book | |
Algorithms + Data Structures = Programs; it's used as the target machine for a | |
PL/0 compiler. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// :) | |
// http://patorjk.com/software/taag/#p=display&f=Graffiti&t=Type%20Something%20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*/ | |
C++ Garbage Collection Library | |
============================== | |
This is a library to manage memory in C++ programs using a garbage | |
collector. It uses a mark and sweep algorithm. | |
All objects that are to be managed by the collector should be derived | |
from GCObject: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Delta Compression by Glenn Fiedler. | |
This source code is placed in the public domain. | |
http://gafferongames.com/2015/03/14/the-networked-physics-data-compression-challenge/ | |
*/ | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <assert.h> | |
#include <string.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// point-to-point distance algorithms survey | |
// - rlyeh, public domain. | |
// possible output { | |
// manhattan_distance: 0.608632s. (result: 6) | |
// octagonal_distance: 0.651783s. (result: 3.52249) | |
// baptista_distance: 1.10458s. (result: 4.79492) | |
// baptista_distance_b: 1.09981s. (result: 4.64063) | |
// euclidean_distance: 1.25s. (result: 4.47214) | |
// euclidean_distance_fast: 1.03207s. (result: 4.5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// l@loup-vaillant.fr | |
#pragma once | |
#include <vector> | |
#include <string> | |
#include <stdlib.h> | |
class Intern { | |
public: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// spinlock c++03/c++11. based on code by Panagiotis Christopoulos Charitos | |
// - rlyeh ~~ public domain | |
#pragma once | |
#if __cplusplus >= 201103L | |
// c++11 version | |
#include <atomic> | |
class SpinLock |