So I’ve been working on the bits and bytes of SSL a lot lately which has required me to look at the OpenSSL code. Long story short, it’s not the prettiest code I’ve ever seen (by a long shot). But it does have a few gems. This gem is going to one of my new interview questions:
void update(unsigned char *buf) {
int i;
for (i = 7; i >= 0; i--) {
++buf[i];
if (buf[i] != 0) break;
}
}
What does this function do? Do you think this is actually faster then obvious the alternative?