Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
I have been replacing multiplications and divisions with shift operators, because shifting is more efficient.
I have been replacing multiplications and divisions with shift operators, because shifting is more efficient.
✍: Guest
This is an excellent example of a potentially risky and usually unnecessary optimization. Any compiler worthy of the name can replace a constant, power-of-two multiplication with a left shift, or a similar division of an unsigned quantity with a right shift. Furthermore, a compiler will make these optimizations only when they're correct; many programmers overlook the fact that shifting a negative value to the right is not equivalent to division. (Therefore, when you need to make sure that these optimizations are performed, you may have to declare relevant variables as unsigned.)
2015-02-09, 1207👍, 0💬
Popular Posts:
How To Control Table Widths? - XHTML 1.0 Tutorials - Understanding Tables and Table Cells Usually, b...
How can we connect to Microsoft Access , Foxpro , Oracle etc ? Microsoft provides System.Data.OleDb ...
What is the difference between CALL_FORM, NEW_FORM and OPEN_FORM? CALL_FORM: start a new form and pa...
How can we suppress a finalize method? GC.SuppressFinalize ()
What is AL.EXE and RESGEN.EXE? In the previous question you have seen how we can use resource files ...