Valence state of hydrogen in hydrides of intermetallic compounds