"Bit-borrow" two numbers Did you know that a small number can borrow bits from a larger number? Here's an example. Let's say our two numbers 5 and 14. First, write them out in binary:
5       14
000101  001110

First we take the smallest on bit away from the larger number, and we give it to the smallest off bit on the other number. So
This bit turns off
            |
            v
000101  001110
    ^
    |
This bit turns on

Now we have
000111  001100

and our numbers are 7 and 12. The first number is still smaller, so we continue.
000111  001100
001111  001000

Now we have 15 and 8, so we can stop. We'll call this set of operations &quot;bit-borrowing&quot; two numbers. Let's do another example. 20 and 61.
20        61
010100    111101
010101    111100
010111    111000
111111    100000
63        32

So our end result is 32, 63. Let's do one more. 31, and 12. 31 is already bigger than 12, so there's nothing to do! Bit-borrowing 31 and 12 gives 31 and 12, no change.
The challenge
Your challenge is to write a program or function that takes two numbers and bit-borrows them. The two numbers will always positive integers. Your input and output can be in any reasonable format.
Test IO:
Input: 2, 3
Output: 3, 2

Input: 3, 2
Output: 3, 2

Input: 8, 23
Output: 31, 0

Input: 42, 81
Output: 63, 0

Input: 38, 41
Output: 47, 32

Input: 16, 73
Output: 23, 0

Input: 17, 17
Output: 17, 17

Standard loopholes apply, and shortest answer in bytes wins!
Jelly, 11 bytes

~1¦&amp;N$^µ&lt;/¿


Try it online! or verify all test cases.

Background

We can extract the last set bit of an integer n as follows.

n + 1 toggles all trailing set bits of n and the adjacent unset bit. For example, 100112 + 1 = 101002.

Since ~n = -(n + 1) = -n - 1, -n = ~n + 1, so -n applies the above to the bitwise NOT of n (which toggles all bits), thus toggling all bits before the last 1.

For example, -101002 = ~101002 + 1 = 010112 + 1 = 011002.

By taking n &amp; -n the bitwise AND of n and -n all bits before the last set bit are nullified (since unequal in n and -n), thus yielding the last set bit of n.

For example, 101002 &amp; -101002 = 101002 &amp; 011002 = 001002.

Thus XORing n with n &amp; -n unsets the last set bit of n.

Conversely, to unset the last set bit of n, it suffices to apply the above to ~n, from where we derive the formula n ^ (~n &amp; -~n).

How it works

~1¦&amp;N$^µ&lt;/¿  Main link. Argument: A (list of pairs)

          ¿  While loop:
        &lt;/     Condition: Reduce p by less-than. True iff x &lt; y.
       µ       Body chain:
~1¦              Apply bitwise NOT to the x, first item of the pair.
     $           Convert the two links to the left into a monadic chain.
    N              Negate; multiply [~x, y] by -1, yielding [-~x, -y].
   &amp;               Logical AND. Yields [-~x &amp; ~x, -y &amp; y].
      ^            Vectorized XOR with p. Yields [(-~x &amp; ~x) ^ x, (-y &amp; y) ^ y].