types: Refactor duplicated value_cast implementation
types: Refactor duplicated value_cast implementation

The two implementations of value_cast were almost identical.

Signed-off-by: Rafael Ávila de Espíndola <1975039f9046bf513b77c0c5639a0efc25f00e7f@scylladb.com>
Message-Id: <20191120181213.111758-3-1975039f9046bf513b77c0c5639a0efc25f00e7f@scylladb.com>

avikivity/scylla,scylladb/scylla,avikivity/scylla,scylladb/scylla,scylladb/scylla,scylladb/scylla,avikivity/scylla