casting between primitives on client