cosmopolitan/dsp/core/twixt8.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

21 lines
428 B
C

#ifndef COSMOPOLITAN_DSP_CORE_TWIXT8_H_
#define COSMOPOLITAN_DSP_CORE_TWIXT8_H_
COSMOPOLITAN_C_START_
/**
* 8-bit linear interpolation kernel.
*/
__funline unsigned char twixt8(unsigned char al, unsigned char bl,
unsigned char p) {
short bx;
bx = bl;
bx -= al;
bx *= p;
bx >>= 8;
bx += al;
al = bx;
return al;
}
COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_DSP_CORE_TWIXT8_H_ */