This file contains hidden or 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
#ifndef QUAKE2_INVSQRT_HPP | |
#define QUAKE2_INVSQRT_HPP | |
// Fast inverse square root algorithm | |
// Credit: Quake III Arena | |
// (Obsolete now due to native CPU support) | |
float invsqrt (float num) { | |
long i = *(long*) &y; // Read the bits of the float as an integer |