A Little C# help please

  • Thread starter Thread starter Harry Simpson
  • Start date Start date
H

Harry Simpson

I've pretty much converted Daniel Moth's AsyncCalcPiCF project to VB.net but
for this one gotcha:

b = b>>1;

converts to

b = Machine.Shift.Right(b,1)

and my compiler burps on the Machine as not be declared.

What could be the CF VB.NET translation?

TIA

Harry
 
Exactly why do you need to bit shift for threading? My guess is that this
is simply part of his sample for the math, making some power-of-two division
faster than by actual division.

b = b >> 1 is the same as saying b /= 2 (or b = b / 2), just faster (though
the compiler may well optimize / 2 to a shift operation anyway, in which
case they would be identical).
 
I should also point out that the output is an integer, not a float, and the
result is simply truncated, so any decimal portion is tossed (not rounded).


--

Chris Tacke, eMVP
Join the Embedded Developer Community
http://community.opennetcf.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top