nicer bitcasts code