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
/** | |
* Generates a pseudorandom number, in the [0, 1[ interval. | |
* @param rng Pointer to the pseudorandom number generator. | |
*/ | |
static inline float rand_f(pcg32_random_t* rng) | |
{ | |
const uint32_t max = 1 << 24; | |
uint32_t r = pcg32_random_r(rng); | |
r &= max - 1; | |
return r * 1.0f / max; |
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
case $(uname -s) in | |
*MINGW*) | |
ln() { | |
options="$1" | |
target="$2" | |
link="$3" | |
if ! [ -L "$link" ] && [ -d "$link" ]; then | |
link="$link/$(basename "$target")" | |
fi |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <fcntl.h> | |
#include <unistd.h> | |
#include <stdbool.h> | |
struct Foo | |
{ | |
int i; |
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
#ifdef _WIN32 | |
#define WIN32_LEAN_AND_MEAN | |
#include <windows.h> | |
LARGE_INTEGER frequency; // init with QueryPerformanceFrequency(&frequency) e.g. at beginning of main() | |
#endif // or go wild and put that in the constructor of a dedicated static object | |
#ifndef _WIN32 | |
#if defined (CLOCK_MONOTONIC) | |
#include <time.h> | |
#else |
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
Renderer: NVIDIA GeForce GT 750M OpenGL Engine | |
Vendor: NVIDIA Corporation | |
Memory: 2048 MB | |
Version: 4.1 NVIDIA-10.10.14 310.42.25f02 | |
Device: MacBookPro11,3 | |
Shading language version: 4.10 | |
Max texture size: 16384 x 16384 | |
Max vertex texture image units: 16 |
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
#include <cstddef> | |
#define array_length(a) sizeof(impl::array_length_requires_array_argument(a)) | |
namespace impl { | |
template<typename T, size_t N> | |
char (&array_length_requires_array_argument(T (&)[N]))[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
// gcc -O3 -march=native -o simplehashing simplehashing.c | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <stdint.h> | |
#include <math.h> | |
#include <string.h> | |
#include <x86intrin.h> | |
// https://github.com/php/php-src/blob/PHP-7.1/Zend/zend_string.h#L325 |
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
#if defined(_WIN32) && defined(_MSC_VER) && (_MSC_VER < 1800) | |
#define SIZET_FMT "%Iu" | |
#elif defined(__linux__) || (defined(_MSC_VER) && (_MSC_VER >= 1800)) | |
#define SIZET_FMT "%zu" | |
#elif defined(__APPLE__) | |
#define SIZET_FMT "%zu" | |
#else | |
#define SIZET_FMT "%u" | |
#endif |
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
[user] | |
name = Gregory Pakosz | |
email = redacted | |
[color] | |
ui = auto | |
[core] | |
autocrlf = false | |
excludesfile = /Users/gregory/.gitignore | |
editor = vim | |
whitespace = cr-at-eol |
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
#include <cstddef> | |
#include <iostream> | |
#define array_length(a) sizeof(implementation::array_length_requires_array_argument(a)) | |
namespace implementation { | |
template<typename T, size_t N> | |
char (&array_length_requires_array_argument(T (&)[N]))[N]; | |
} // namespace implementation |
NewerOlder