Skip to content

Instantly share code, notes, and snippets.

@sergof
sergof / expression.c
Last active June 23, 2018 17:01
Simple expression evaluator, generates machine code for x64 and uses virtual machine otherwise.
/*
* Copyright (c) 2017-2018 Sergej Reich
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
/* Quasi random point sequence
* based on: http://extremelearning.com.au/a-simple-method-to-construct-isotropic-quasirandom-blue-noise-point-sequences/ */
void r2(float *x, float *y, uint32_t i, float jitter)
{
assert(i > 0);
assert(jitter >= 0.0f);
float phi = 1.324717957244746f;
float sqrtpi = 1.7724538509055159f;
float a0 = 1.0f / phi;
@sergof
sergof / game_changer.c
Last active February 13, 2019 14:27
A way of embedding build instructions inside a C file in a bash environment, so they can act as "scripts"
#if 0
cc ${0} -o _script_
./_script_ "${@}"
ret=$?
rm _script_
exit $ret
#endif