The rule is that you have offset losses before applying the 50% discount. The 50% discount only applies to gains on holdings held longer than 12 months. So to minimise your tax you offset the losses against the <12 months first, then > 12 months & then discount only what"s left of the > 12 months.
If you wanted to you could offset the losses against the > 12 months but you would pay more tax so no one intentionally would.