Well, first that line in question is a ternary. In the line var foo = qux ? bar : baz;, if qux is true, then foo = bar, else foo = baz. But for that to work the part before the ? has to be evaluated as a boolean. In this case, it has to test if a is less than .5. When doing operations like this to a vector value, like half4, each component is operated on separately. So in a simple example:
So, back to the issue of getting “odd results”. I suspect the issue you’re having has nothing to do with the above function, and more to do with linear vs gamma color spaces. Photoshop does all of it’s blends in gamma space, but if your Unity project is using linear color space, then the color values your shader is working with is linear space color values, which won’t look the same when blended with an overlay.
You can either change your project to gamma space, or you can convert the values to gamma space in the shader to do the conversion and back to linear to output.