Ah, so if it has a 30 hp iv, I should give it the 4 hp evs, and if it has 31, it doesn't matter unless I give anymore than 8?
Yes. Like XienZo said, for stealth rock avoid hp divisible by four. With a 30 hp iv, that means giving it at least four ev's, but never a multiple of sixteen (that would defeat the purpose of avoiding hp totals that are multiples of four). With a 31 hp iv, that means you can give it hp ev's if you want, but you don't have to to avoid stealth rock killing in four turns. Just make sure you avoid giving yourself four evs less than any multiple of sixteen (that, once again, would defeat the purpose of avoiding hp totals that are multiples of four).