I'm reading the source code of a stream cypher (zuc): I cannot understand properly why they define the multiplication by power of 2 in this way:
#define MulByPow2(x, k) ( ( ((x) << k)|((x) >> (31 - k)) & 0x7FFFFFFF)
In the example $x$ is the first term of the product and $k$ is the power of $2$. for who don't understand c here's the translation: * ((x) << k) is the binary left shifting operation by k position. This correspond to the usual multiplication by power of 2. * | is the bitwise OR operator * (x) >> (31 - k) is the opopsite operation of <<. * & 0x7FFFFFFF i think this play the role of mod(2^31-1)
I don't get the meaning of "|((x) >> (31 - k)) " in the multiplication.
Thanks for help. :)