classlib: Avoid non-inlined 'switch' function