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
# ------------------------------------------------------------------------------ | |
# int32_t dotProduct_16x8_neon(int16_t const* __restrict u, int8_t const* __restrict v, int32_t size) | |
.globl _dotProduct_16x8_neon | |
.private_extern _dotProduct_16x8_neon | |
.no_dead_strip _dotProduct_16x8_neon | |
_dotProduct_16x8_neon: | |
# calling conventions: | |
#--------------------- |
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
" -- tabular settings ---------------------------------------------------------- | |
nnoremap <silent> <Leader>a= :Tabularize /=<CR> | |
vnoremap <silent> <Leader>a= :Tabularize /=<CR> | |
nnoremap <silent> <Leader>a: :Tabularize /:\zs<CR> | |
vnoremap <silent> <Leader>a: :Tabularize /:\zs<CR> | |
" auto align on pipes | |
inoremap <silent> <Bar> <Bar><Esc>:call <SID>pipe_align()<CR>a | |
function! s:pipe_align() |
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
#!/bin/sh | |
# exit the script if any statement returns a non-true return value | |
set -e | |
# exit the script on dereferencing uninitialised variables | |
set -o nounset | |
self=$(basename $0) | |
origin=$(cd "$(dirname "$0")"; pwd) |
NewerOlder