Re: mu TECH: an unhurried digression on C pointers vs. a

From: HTom4722@aol.com
Date: Fri Apr 28 2000 - 14:51:59 CEST


The "pointer vs. array" squabble has gone on since the invention of C (and
was going on before then as the "address vs. array" battle between the
assembly language and Fortran troops.) You can write inefficient code in
any of the languages, and efficient code in any of them.

----
multiply (integer) value by six, without multiply:
 
t1 :=  leftshift(value)    {t1 =  2 * value}
t1 :=  t1 +  value         {t1 =  3 * value}
t1 :=  leftshift(t1)         {t1 =  6 * value} 
Good compilers targeted at hardware (as opposed to an intermediate language) 
will generate such things for small values; "small" depends on the speed of 
the various instructions and whether we are optimizing for code size or code 
speed.  
htom
---------------------------------------------------------------------
To unsubscribe, e-mail: mulinux-unsubscribe@sunsite.auc.dk
For additional commands, e-mail: mulinux-help@sunsite.auc.dk


This archive was generated by hypermail 2.1.6 : Sat Feb 08 2003 - 15:27:14 CET