Uses a union to encode data.