#!/usr/local/bin/tcc -run #include void main(){ uint32_t phase += 0x10000000; uint16_t out = (phase >> 16) + 0x4000; int32_t falling = out >= 0x8000; out = out * (1 - falling); out += (0x10000 - out) * falling; printf("%d\n", (out - 0x4000) >> 1); }