I see where you're coming from, but it won't work. The ifdef's make sure the to_x it evaluates true for is the ONLY type that gets returned. If you do "if C::ModeT == xxxx" then it'll be either a UInt16 or UInt32 (or nil if you don't put an "else" in).

In this case, what you're looking for is the ability to do an "ifdef C::ModeT == UInt16", which the compiler (currently) doesn't do.