I should've known byuu's cutting-edge C++ would run afoul of the "we'd rather you use Visual Basic" compiler ;-)

Does "r = (q << 1) | c ? 1 : 0;" work?