I prefer how it was done in util.cpp as it allows you to discriminate between the char '0' and an invalid hex char.
Note that I have modified the uint256.h code in consequence when it search for the end of the number.