Search code examples
clinuxkernel

What does ">>=" mean in Linux kernel source code?


in Linux kernel source code, I find below code:

    h++;
    pending >>= 1;

It is part of __do_softirq(void). But what does ">>=" mean? Why isn't it ">>" as I remember? Thanks!


Solution

  • It simply does

    pending = pending >>1;
    

    In short it divides by 2 an unsigned int.

    That's the same construct than +=, /=, etc.

    It's not just pending >>1 as you remember because that wouldn't store the result of the shift operation in the variable.