Re: Rotate Left from C

"Mattias Engdegård" <>
20 Oct 2002 22:49:17 -0400

          From comp.compilers

Related articles
Rotate Left from C (David Sexton) (2002-10-18)
Re: Rotate Left from C (Mattias Engdegård) (2002-10-20)
Re: Rotate Left from C (Lieven Marchand) (2002-10-20)
Re: Rotate Left from C (Torben Ægidius Mogensen) (2002-10-24)
| List of all articles for this month |

From: "Mattias Engdegård" <>
Newsgroups: comp.compilers
Date: 20 Oct 2002 22:49:17 -0400
Organization: Compilers Central
References: 02-10-065
Keywords: architecture
Posted-Date: 20 Oct 2002 22:49:17 EDT

"David Sexton" <> writes:
>#define KONROL32(theNum,theRot) ((theNum) << (theRot)) | ((theNum) >>
>(32 - theRot)))

>As you can see, I want to use function definitions that use the
>processor's ROL instruction rather than having to use that default
>macro which is significantly slower.

Gcc will generate a rotate instruction (if available) for the above
code. Other modern compilers likely do the same. If not, it's probably
because their programmers didn't consider rotates to be common enough
to be worth the effort. (They mostly turn up in cryptographic code

>[How many machines still have rotate instructions? I thought they had
>gone out of fashion. Yes, I know the Pentium does, but its instruction
>set dates from the 1970s. -John]

IA-64 (kind of)

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.