cosmopolitan/dsp/core/c161s.h
Justine Tunney fa20edc44d
Reduce header complexity
- Remove most __ASSEMBLER__ __LINKER__ ifdefs
- Rename libc/intrin/bits.h to libc/serialize.h
- Block pthread cancelation in fchmodat() polyfill
- Remove `clang-format off` statements in third_party
2023-11-28 14:39:42 -08:00

22 lines
514 B
C

#ifndef COSMOPOLITAN_DSP_CORE_C161S_H_
#define COSMOPOLITAN_DSP_CORE_C161S_H_
#include "dsp/core/c161.h"
#include "libc/macros.internal.h"
__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 /* COSMOPOLITAN_DSP_CORE_C161S_H_ */