Super Mario 64 Source
A Super Mario 64 decompilation, brought to you by a bunch of clever folks.
Functions
quant.c File Reference
#include "vadpcm.h"

Functions

s16 qsample (f32 x, s32 scale)
 Compute x / scale rounded to the nearest integer, with x.5 (fuzzy with an epsilon of 1e-7) rounding towards zero. More...
 
void clamp (s32 fs, f32 *e, s32 *ie, s32 bits)
 Round all ('fs' many) values in 'e' to the nearest 'bits'-bit integer, outputting to 'ie'. More...
 
s32 clip (s32 ix, s32 llevel, s32 ulevel)
 Clamp ix to within [llevel, ulevel]. More...
 

Function Documentation

◆ clamp()

void clamp ( s32  fs,
f32 e,
s32 ie,
s32  bits 
)

Round all ('fs' many) values in 'e' to the nearest 'bits'-bit integer, outputting to 'ie'.

◆ clip()

s32 clip ( s32  ix,
s32  llevel,
s32  ulevel 
)

Clamp ix to within [llevel, ulevel].

◆ qsample()

s16 qsample ( f32  x,
s32  scale 
)

Compute x / scale rounded to the nearest integer, with x.5 (fuzzy with an epsilon of 1e-7) rounding towards zero.