Add safe variants of from_big/little_endians.