The patch disables a quality optimization that targeted the old psychoacoustic model. The old model has been removed years ago, but the optimization has been kept in place and reduces quality with the new model. The patch should be very safe to use, but you can also just use the latest official version and disable the offending code by specifying the "-q 4" command line switch.
This should not be platform-specific. Note, however, that at a high bitrate such as 320 kbps, it's rather unexpected to find cases where one "sounds way better" than the other. Did you check your findings via ABX testing?
Here's another patch approach: This makes -q4 the lowest quality setting (providing the best quality) for CBR and ABR. This is similar how for the new VBR mode, some quality settings are disallowed as well (a few lines prior).
The problem of q0/q1/q2/q3 producing worse results for CBR/ABR was introduced with this change: https://sourceforge.net/p/lame/svn/6147/ This enabled the new VBR-psymodel for CBR and ABR, which happened to help with https://sourceforge.net/p/lame/bugs/392/ (which also is about lower speed settings introducing artifacts).
ABR seems to be affected similarly to CBR. Here's a slightly expanded trivial patch to disable noise_shaping_amp for ABR as well.
Here's a trivial patch that sets noise_shaping_amp to 0 for CBR encoding.
For some reason, I accidentally filed this in group "Compatibility". More fitting would be "Quality", of course.
CBR: High quality settings (e.g, -q 0) degrade quality over -q 4