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
// Minimal Murmur3 implementation shared by Demetri Spanos on Handmade Network Discord | |
// | |
// Code is deliberately terse and simplistic | |
// Intended to be the first hash function you reach for e.g. a simple hash table | |
// *** NB THIS IS NOT A CRYPTOGRAPHIC HASH *** | |
// | |
// @demetrispanos: | |
// "yes let me reiterate the moral of this story | |
// there is never any reason to use a dumb made up hash function | |
// use murmur3 or jenkins-one-at-a-time for a 0-effort version |
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
// From: https://web.archive.org/web/20080228213915/http://www.devmaster.net/forums/showthread.php?t=5784 | |
float sinApprox(float x) | |
{ | |
const float kPI32 = 3.14159265359f; | |
const float B = 4/kPI32; | |
const float C = -4/(kPI32*kPI32); | |
float y = B * x + C * x * abs(x); |
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
// Source: https://www.youtube.com/watch?v=1xlCVBIF_ig | |
float cubicSinf(float x) | |
{ | |
float t = x * 0.15915f; | |
t = t - (int)t; | |
return 20.785f * t * (t - 0.5f) * (t - 1.f); | |
} |
NewerOlder