Manipulating functions 
Let $g(n)$ be a function, defined for all integers $n\ge 0$, as follows:
$$g(n) = \begin{cases} 0, & \text{if } n=0 \\ 1+g(n/2), & \text{if $n\gt 0$ and $n$ is even} \\ 1+g(n-1), & \text{if $n\gt 0$ and $n$ is odd}\end{cases}$$
What is $g(2^l+2^k)$ where $l\gt k\ge 0$ are integers?

I have have solutions which state:

For natural numbers $l\gt k\ge 0$ $$g(2^l + 2^k) = k+g(2^{l-k}+1) = k+1+g(2^{l-k}) = k+1+l-k+1=l+2$$

But can't understand what it is saying.  I see that obviously $\dfrac{2^l + 2^k}{2^k} = 2^{l-k} + 1$. But other than that, I am having a hard time trying to grasp the other operations in the solution.

Using each of the rules for $g$:
$$\begin{align}
\color{red}{g(2^l + 2^k)} &= g\big(2^k(2^{l-k} + 1)\big) \\ &= 1 + g\big(2^{k-1}(2^{l-k} + 1)\big) \\ & \qquad\vdots \\ &= \color{red}{k+g(2^{l-k}+1)} \\ &= k+1+g\big((2^{l-k}+1)-1\big) \\ &= \color{red}{k+1+g(2^{l-k})} \\ &= k+1 + \big(1+ g(2^{l-k-1})\big)\\ &\qquad \vdots \\ &= k+1 + \big(l-k+g(1)\big)\\ &= \color{red}{k+1+(l-k+1)} \\ &=\color{red}{l+2}
\end{align}$$
