help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NewB Question


From: Paul Floyd
Subject: Re: NewB Question
Date: 13 Dec 2010 08:37:06 GMT
User-agent: slrn/0.9.8.1pl1 (SunOS)

On Sun, 12 Dec 2010 08:07:33 -0800 (PST), ArbolOne <arbolone@gmail.com> wrote:
> In this function:
> static inline void vlc_mouse_SetPressed( vlc_mouse_t *p_mouse,
>                                          int i_button )
> {
>     p_mouse->i_pressed |= 1 << i_button;
> }
>
> What is the meaning of 'p_mouse->i_pressed |= 1 << i_button;' ??

|= is "assignment or", the left value becomes the result of the bitwise
or of the left and right values. In this case, the right value is "1 <<
i_button".

<< is shift left, the bit pattern (here, 1) is shifted left the right
value number of bits (i_button). I'll leave it to you to check up on
what happens if the number of bits is negative or more than the size
in bits of the destination.

A bientot
Paul
-- 
Paul Floyd                 http://paulf.free.fr


reply via email to

[Prev in Thread] Current Thread [Next in Thread]