[Semibug] Need Help with C language
jondrews at fastmail.com
Sun Oct 17 19:41:43 EDT 2021
I found the answer myself in Kernighan and Ritchie "The C Programming Language",
expr1 op= expr2 is equivalent to expr1 = expr1 op expr2 where op is any of the
following: + - * / % << >> & ^ |. This also holds true for ksh93. Namely in ksh93
i = ( i << 1 ) is the same as i <<= 1.
On Sun, Oct 17, 2021, at 16:23, Jonathan Drews wrote:
> I think I understand what is going on. Just as i = i + 1 can be written as
> i += 1 so also can i = ( i << 1 ) be written as i <<= 1. Am I understanding that correctly?
> On Sun, Oct 17, 2021, at 09:47, Job Snijders wrote:
>> On Sun, Oct 17, 2021 at 09:43:40AM -0600, Jonathan Drews wrote:
>> > I know that it << 1 is a bitwise shift operation. What does it <<= 1 mean?
>> This is a 'bitwise assignment operator'.
>> The string '<<=' means "left shift assignment"
>> Kind regards,
> Semibug mailing list
> Semibug at lists.nycbug.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Semibug