It fixes the shares looking high because the (I am guessing backup Bitcoin) target is far higher. I would rather see what the highest achieved was not the highest accepted was.
Seems like a solution in search of a problem.
Both before and after intend to show the highest achieved. But the cgminer code calculated the hash twice, in two different ways, and the hash-to-difficulty code assumed it was one of those ways. When the share doesn't meet the pool target, the hash-to-difficulty code was run on it with its hash calculated the opposite way, and as a result gave the wrong result. My rewrite cleans up the code so it's actually readable, and makes the share->hash value always consistent with SHA256 and the share_diff function expectations.
I also wrote a much-less-changed fix for BFGMiner 2.8.x and 2.9.x:
https://github.com/luke-jr/bfgminer/commit/006faacThis one doesn't clean up the code to make it more readable, though. But as a diff, it is easier to see what the problem was.
The function you replaced works fine and does exactly what I wrote it to do 15 months ago.
Check and see if it was a block based on the block header difficulty.
... though as I said, it's way faster that your replacement - which most likely is code you just copied out of elsewhere (and now say it's yours)
Oddly enough that's still required in cgminer - I guess the clone doesn't need that any more
There is nothing to clean up except your retarded brain not being able to understand the simple original code I wrote.