You just check the c flag. If during the "sbc" part of the code, there was a carry, it would mean that de was larger than hl. That means that immediately after when you do the "add" instruction that if there was a carry during the subtraction, there must also be a carry during the addition to get back to the original value. So the c flag is still in the correct state by the end of that routine. If you don't need to preserve the value of hl after the comparison, you can omit the "add" part.