If you like this sort of weird bit operations, you should check out HAKMEM, a huge list of hacks created at MIT in 1972.
"Here is some little known data which may be of interest to computer hackers. The items and examples are so sketchy that to decipher them may require more sincerity and curiosity than a non-hacker can muster. Doubtless, little of this is new, but nowadays it's hard to tell."
https://w3.pppl.gov/~hammett/work/2009/AIM-239-ocr.pdf - see e.g. page 79