Fix unsigned int overflow reported by clang's integer sanitizer.
diff --git a/asio/include/asio/detail/timer_queue.hpp b/asio/include/asio/detail/timer_queue.hpp
index 929dfeb..55c255f 100644
--- a/asio/include/asio/detail/timer_queue.hpp
+++ b/asio/include/asio/detail/timer_queue.hpp
@@ -219,13 +219,13 @@
   // Move the item at the given index up the heap to its correct position.
   void up_heap(std::size_t index)
   {
-    std::size_t parent = (index - 1) / 2;
-    while (index > 0
-        && Time_Traits::less_than(heap_[index].time_, heap_[parent].time_))
+    while (index > 0)
     {
+      std::size_t parent = (index - 1) / 2;
+      if (!Time_Traits::less_than(heap_[index].time_, heap_[parent].time_))
+        break;
       swap_heap(index, parent);
       index = parent;
-      parent = (index - 1) / 2;
     }
   }
 
@@ -272,9 +272,8 @@
       {
         swap_heap(index, heap_.size() - 1);
         heap_.pop_back();
-        std::size_t parent = (index - 1) / 2;
         if (index > 0 && Time_Traits::less_than(
-              heap_[index].time_, heap_[parent].time_))
+              heap_[index].time_, heap_[(index - 1) / 2].time_))
           up_heap(index);
         else
           down_heap(index);