Compiler Specific Operators

roy at phri.UUCP roy at phri.UUCP
Sun Jul 13 04:36:11 AEST 1986


In article <1825 at uw-beaver> golde at uw-beaver.UUCP (Helmut Golde) writes:

> What do people think about allowing compilers to have their own
> compiler/machine specific operators, in a standardized format. [...]
> a $rol$= 5;	/* rotate a left 5 bits */

	If you want to do that sort of stuff (gross, but admitedly sometimes
worth the big efficiency win), what's wrong with the following?

# ifdef MY_FAVORITE_CPU
asm ("rol a, #5");	/* Use nifty built-in rotate left instruction */
# elseif
a = rol_func (a);	/* Don't have that instruction? do it in software */
# endif

	If you wanted to be cynical, you could always claim that we already
do have exactly what you are talking about :-)

	a <<= 5;	/* use nifty pdp-11 shift-left instruction */
	b = *--p;	/* use nifty pdp-11 auto-decrement mode */
-- 
Roy Smith, {allegra,philabs}!phri!roy
System Administrator, Public Health Research Institute
455 First Avenue, New York, NY 10016



More information about the Comp.lang.c mailing list