Sure, I agree that is generally more useful, but if you intend on keeping it this way, you need to check for the -1 value as well in the caller site .

If you return a special error token can't just bitshift and or it into the target value without checking. If you return 0 you can because it's a no-op/ignore. And as SetHex has no way to return parsing errors the only way is to ignore errors.