Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Does C have circular shift operators?

circular operators shift
0
Posted

Does C have circular shift operators?

0

No. (Part of the reason why is that the sizes of C’s types aren’t precisely defined–see question 1.2–but a circular shift makes most sense when applied to a word of a particular known size.) You can implement a circular shift using two regular shifts and a bitwise OR: (x << 13) | (x >> 3) /* circular shift left 13 in 16 bits */ comp.lang.c FAQ list · Question 20.21b Q: Is C a great language, or what? Where else could you write something like a+++++b ? A: Well, you can’t meaningfully write it in C, either. The rule for lexical analysis is that at each point during a straightforward left-to-right scan, the longest possible token is determined, without regard to whether the resulting sequence of tokens makes sense. The fragment in the question is therefore interpreted as a ++ ++ + b and cannot be parsed as a valid expression. References: K&R1 Sec. A2 p. 179 K&R2 Sec. A2.1 p. 192 ISO Sec. 6.1 H&S Sec. 2.3 pp. 19-20 comp.lang.c FAQ list · Question 20.22 Q: If the assignment operator were

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123