Rotate Left from C

"David Sexton" <da5id65536@yahoo.com>
18 Oct 2002 23:36:06 -0400

          From comp.compilers

Related articles
Rotate Left from C da5id65536@yahoo.com (David Sexton) (2002-10-18)
Re: Rotate Left from C f91-men@nada.kth.se (Mattias Engdegård) (2002-10-20)
Re: Rotate Left from C mal@wyrd.be (Lieven Marchand) (2002-10-20)
Re: Rotate Left from C torbenm@diku.dk (Torben Ægidius Mogensen) (2002-10-24)
| List of all articles for this month |
From: "David Sexton" <da5id65536@yahoo.com>
Newsgroups: comp.compilers
Date: 18 Oct 2002 23:36:06 -0400
Organization: http://groups.google.com/
Keywords: architecture
Posted-Date: 18 Oct 2002 23:36:06 EDT

The following lines appear in one of my source code files.


#if defined __TCS__ /* TriMedia complier */
#include "custom_defs.h"
#define KONROL32(theNum,theRot) ROLI (theNum, theRot)
#elif defined _MSC_VER /* Microsoft compiler */
#include <stdlib.h>
#define KONROL32(theNum,theRot) _lrotl (theNum, theRot)
#elif defined THINK_C /* 68K Macintosh compiler */
#pragma parameter __D0 KONROL32 (__D0, __D1)
pascal unsigned long KONROL32 (unsigned long theNum, unsigned char
theRot) = 0xE3B8;
#else
#define KONROL32(theNum,theRot) ((theNum) << (theRot)) | ((theNum) >>
(32 - theRot)))
#endif


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. I'd like to add some other
platforms. Any help or hints will be appreciated.


Dave Sexton
[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]



Post a followup to this message

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