From: Spehro Pefhany
Newsgroups: sci.electronics.design
Subject: Re: To C or not to C
Organization: Rather
Message-ID: <4b2h1v4s5e6cv65h6b75e1fj1j4ug3llih@4ax.com>
References: <3e1853bb.20798186@news.planet.nl> <3e187255$0$57466$1b62eedf@news.euronet.nl> <3e1880cf$0$57462$1b62eedf@news.euronet.nl> <3e188467.33257802@news.planet.nl> <3e1888b5$0$57480$1b62eedf@news.euronet.nl>
X-Newsreader: Forte Agent 1.92/32.572
Date: Sun, 05 Jan 2003 19:39:00 GMT
NNTP-Posting-Host: 24.112.151.88
NNTP-Posting-Date: Sun, 05 Jan 2003 14:39:00 EST
On Sun, 5 Jan 2003 20:33:17 +0100, the renowned "Frank Bemelman"
wrote:
>"Nico Coesel" schreef in bericht
>news:3e188467.33257802@news.planet.nl...
>> "Frank Bemelman" wrote:
>>
>> >Thanks, I actually realized shortly after I'd hit the 'send' button. I
>also
>> >wondered if a HC11/12 C compiler wouldn't use that single asm-instruction
>> >if you coded something like ucValue |= 0x55;
>>
>> Only one way to find out; flip one bit this way and look what the
>> compiler produces. Many compilers, for examples, replace a division or
>> multiplycation by 2^n with a shift instruction.
>
>Yes, or even follow it with an add or sub, when multipying by 9 or 7 etc.
Are any compilers for micros that smart? This is another case where a
bit of inline assembly can make things fly- hard wiring multiplication
by constants. Compared to naive division by a constant, it might be
100* faster.
Best regards,
Spehro Pefhany
--
"it's the network..." "The Journey is the reward"
speff@interlog.com Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog Info for designers: http://www.speff.com