From 4b3afafb000f7aa0fbad3695a5faf7ef68c77897 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 13 Jul 2022 15:13:07 -0600 Subject: [PATCH] [array] Use hb_swap() in reverse() --- src/hb-array.hh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/hb-array.hh b/src/hb-array.hh index 5baeb6f7f..410d72a1f 100644 --- a/src/hb-array.hh +++ b/src/hb-array.hh @@ -220,11 +220,8 @@ struct hb_array_t : hb_iter_with_fallback_t, Type&> if (end < start + 2) return; - for (unsigned lhs = start, rhs = end - 1; lhs < rhs; lhs++, rhs--) { - Type temp = arrayZ[rhs]; - arrayZ[rhs] = arrayZ[lhs]; - arrayZ[lhs] = temp; - } + for (unsigned lhs = start, rhs = end - 1; lhs < rhs; lhs++, rhs--) + hb_swap (arrayZ[rhs], arrayZ[lhs]); } hb_array_t sub_array (unsigned int start_offset = 0, unsigned int *seg_count = nullptr /* IN/OUT */) const