take some branches out of the hot path, which means converting some places to for loops. Change-Id: Idcac06f27761994e2554f723662f242a38d3778c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199853 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins