From 326d319f93fe6173344602929fdbb5ba27412388 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 15 Jul 2023 13:14:34 -0600 Subject: [PATCH] [graph] Micro-optimize --- src/graph/graph.hh | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/graph/graph.hh b/src/graph/graph.hh index 5a6fc1b82..9d35851a0 100644 --- a/src/graph/graph.hh +++ b/src/graph/graph.hh @@ -1252,12 +1252,8 @@ struct graph_t // (such as a fibonacci queue) with a fast decrease priority. unsigned count = vertices_.length; for (unsigned i = 0; i < count; i++) - { - if (i == vertices_.length - 1) - vertices_.arrayZ[i].distance = 0; - else - vertices_.arrayZ[i].distance = hb_int_max (int64_t); - } + vertices_.arrayZ[i].distance = hb_int_max (int64_t); + vertices_.tail ().distance = 0; hb_priority_queue_t queue; queue.insert (0, vertices_.length - 1);