actionscript 3 - AS3 bitwise shift 0? -


I came across some AS 3.0 code on this:

  (duration> Gt; 0)  

Where duration is a number I think I know what does, but what does the transfer of 0 bits mean? This code takes some time, I think what it does.

There are a few reasons for this.

First, multiplication and division actually In some circumstances, when we use shift, the correct change ...

i.e. binary is number 1 00000001, left it to be 00000010 and now is 2 .. i.e. 1 X 2

Shift twice to multiply / divide by 4, 3 times for 8, 4 times for 16, etc. ...

Is not used often, but In case of physical science engine port from C / C ++, in large quantities of data processing, or in some 3D engine, we will see it as shifts for the predecessor of the original code, or just for speed.

(You can also look at it on some J2ME mobile Java games, for example, floating point units are not available or enter a value of 10 bits so that the remaining 10 bits work as a decimal point Then move it back to the real value, when dragged to the position of the screen at the size of the overall position)

Other uses have been referred to as Quick Math Floor (); - But with a major WinterSenser. A few months ago I had worked with Box 2D and found it strangely hundreds of times, because I think both conversions are handled basically.

Going round the negative numbers,
Math.floor (-7.6) = -8 and (-7.6 <-0

Ie On a number (float) & lt; & Lt; Will make goals in the direction of 0.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -