Falls x != y nicht sichergestellt werden kann, wäre ein if allerdings die sauberste Lösung...

Code:
int16_t tmp = (x != y) ? (((int32_t)x << 15) / y) : 32767;

foo(tmp)