Skip to content

Instantly share code, notes, and snippets.

View TriceHelix's full-sized avatar
⌨️
coding

Trice Helix TriceHelix

⌨️
coding
View GitHub Profile
@TriceHelix
TriceHelix / float16.c
Last active November 13, 2022 11:34 — forked from neshume/float16.c
Super Fast Conversion Between Half-Precision and Single-Precision Floating Point Numbers in C
// float32
// Martin Kallman
//
// Fast half-precision to single-precision floating point conversion
// - Supports signed zero and denormals-as-zero (DAZ)
// - Does not support infinities or NaN
// - Few, partially pipelinable, non-branching instructions,
// - Core opreations ~6 clock cycles on modern x86-64
void float32(float* __restrict out, const uint16_t in) {
uint32_t t1;