The Cyber-Spy.Com Usenet Archive Feeds Directly From The Open And Publicly Available Newsgroup Sci.Electronics.Design
This Group And Thousands Of Others Are Available On Most IS NNTP News Servers On Port 119.
Cyber-Spy.Com Is NOT Responsible For Any Topic, Opinions Or Content Posted To This Or Any Other Newsgroup. This Web Archive Of The Newsgroup And Posts Are For Informational Purposes Only.
From: "Frank Bemelman"
Newsgroups: sci.electronics.design
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> <4b2h1v4s5e6cv65h6b75e1fj1j4ug3llih@4ax.com>
Subject: Re: To C or not to C
Date: Sun, 5 Jan 2003 21:06:54 +0100
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
Message-ID: <3e189110$0$57479$1b62eedf@news.euronet.nl>
Organization: EuroNet Internet
NNTP-Posting-Date: 05 Jan 2003 20:09:52 GMT
NNTP-Posting-Host: hlg-n-5c88.mxs.adsl.euronet.nl
"Spehro Pefhany" schreef in bericht
news:4b2h1v4s5e6cv65h6b75e1fj1j4ug3llih@4ax.com...
> 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.
The last time I saw this 'trick' with add/sub was when using a 68000
compiler.
I never checked this with 8051, but I try to keep my multiplying in powers
of 2 and mandating the shift by using << etc. and keeping them outside loops
if not avoiding them altogether ;)
--
Thanks,
Frank Bemelman
(remove 'x' & .invalid when sending email)
Go Back To The Cyber-Spy.Com Usenet Web Archive Index Of The sci.electronics.design Newsgroup
|