Asymptotic time complexity of a two-loop program I have two pieces of code in a function which I'm trying to calculate the asymptotic running time for:

for (int x = 0; x &lt; y; x++) {
    total  +=  total;
    total  +=  x;
}


and:

while (y &gt; 0) {
    total  -=  y;
    y  =  y/2;
}


Combining those two pieces of code, what is the run time of that function and how do I calculate it?
The first loop has $y$ iterations, each iteration takes constant time ($O(1)$), so all together we have $O(y)$. The second loop has $\log_2(y)$ iterations of constant time, giving a complexity of $O(\log_2(y))$. Both loops together we have: $O(y + \log_2(y)) = O(y)$ because $y$ dominates $\log_2(y)$.