This file contains hidden or 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
#ifndef MCS_LOCK_H | |
#define MCS_LOCK_H | |
#include <cstdint> | |
#include <assert.h> | |
#include <atomic> | |
#include <thread> | |
#include <iostream> |
This file contains hidden or 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
#ifndef CPU_RELAX_H | |
#define CPU_RELAX_H | |
#include <intrin.h> | |
namespace sync { | |
inline static void cpu_relax() { | |
#if (COMPILER == MVCC) |
This file contains hidden or 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
module AlgorithmW | |
// HINDLEY-MILNER TYPE INFERENCE | |
// Based on http://catamorph.de/documents/AlgorithmW.pdf | |
// (Now at http://web.archive.org/web/20170704013532/http://catamorph.de/documents/AlgorithmW.pdf) | |
type Lit = | |
| LInt of int | |
| LBool of bool |
This file contains hidden or 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
// Creating a node graph editor for Dear ImGui | |
// Quick sample, not production code! | |
// This is quick demo I crafted in a few hours in 2015 showcasing how to use Dear ImGui to create custom stuff, | |
// which ended up feeding a thread full of better experiments. | |
// See https://github.com/ocornut/imgui/issues/306 for details | |
// Fast forward to 2023, see e.g. https://github.com/ocornut/imgui/wiki/Useful-Extensions#node-editors | |
// Changelog | |
// - v0.05 (2023-03): fixed for renamed api: AddBezierCurve()->AddBezierCubic(). |
This file contains hidden or 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
// Mini memory editor for Dear ImGui (to embed in your game/tools) | |
// Animated GIF: https://twitter.com/ocornut/status/894242704317530112 | |
// THE MEMORY EDITOR CODE HAS MOVED TO GIT: | |
// https://github.com/ocornut/imgui_club/tree/master/imgui_memory_editor | |
// Click "Revisions" on the Gist to see old version. |
This file contains hidden or 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 hidden or 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
\ Computing mean and population standard deviation in Forth. | |
\ Tested on Gforth 0.7.0 | |
16 constant FRAC \ number of bits behind fixed-point | |
\ convert from/to fixed point representation | |
: s>fix FRAC lshift ; | |
: fix>s FRAC rshift ; | |
\ fixed-point arithmetic |