mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 11:37:35 +00:00
24 lines
599 B
C
24 lines
599 B
C
#ifndef COSMOPOLITAN_DSP_CORE_C161S_H_
|
|
#define COSMOPOLITAN_DSP_CORE_C161S_H_
|
|
#include "dsp/core/c161.h"
|
|
#include "libc/macros.internal.h"
|
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
|
|
|
__funline signed char C161S(signed char al, signed char bl, signed char cl) {
|
|
short ax, bx, cx;
|
|
ax = al;
|
|
bx = bl;
|
|
cx = cl;
|
|
ax *= -1 * EXTRA_SHARP;
|
|
bx *= 6 * EXTRA_SHARP;
|
|
cx *= -1 * EXTRA_SHARP;
|
|
ax += bx;
|
|
ax += cx;
|
|
ax += 2 * EXTRA_SHARP;
|
|
ax /= 4 * EXTRA_SHARP;
|
|
al = MIN(112, MAX(-112, ax));
|
|
return al;
|
|
}
|
|
|
|
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
|
#endif /* COSMOPOLITAN_DSP_CORE_C161S_H_ */
|