this post was submitted on 25 Nov 2025
328 points (99.4% liked)
Programmer Humor
27506 readers
1495 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Take from index 10 of the buffer, AND it with some hard-coded hex value.
Bit shift it by a hard-coded amount of 2
Do the first two steps, but with a different hard-coded index, hex value, and bit shift.
OR the two results.
Shove the result back into a buffer.
All of this is one line with no commenting or references to what the fuck this process comes from or why it is applicable. Then there was a second copy of the line, but with different hard-coded values.
Ok that is truly horrid...
Can you say what the point of it actually was?
Nope. It was buried 300 lines into a 600 line C function.
The cherry on top was that testing at this place was all manually done on the hardware. And the "unit testing" comprised of making one off tests to prove line coverage, then throwing out the unit tests because the IDE we were using would have an aneurysm if it tried to open up existing unit tests.
I was the poor fuck tasked with writing throw away "unit testing" code for that bastard of a function. All of it was probably written before I was born.