Is It Worth Using Bitwise Operators In Methods?
Posted
by
user1626141
on Stack Overflow
See other posts from Stack Overflow
or by user1626141
Published on 2012-08-28T21:33:52Z
Indexed on
2012/08/28
21:38 UTC
Read the original article
Hit count: 162
I am very new to Java (and programming in general, my previous experience is with ActionScript 2.0 and some simple JavaScript), and I am working my way slowly and methodically through Java: A Beginner's Guide by Herbert Schildt. It is an incredible book.
For one thing, I finally understand more-or-less what bitwise operators (which I first encountered in ActionScript 2.0) do, and that they are more efficient than other methods for certain sums.
My question is, is it more efficient to use a method that uses, say, a shift right, to perform all your divisions/2 (or divisions/even) for you in a large program with many calculations (in this case, a sprawling RPG), or is it more efficient to simply use standard mathematical operations because the compiler will optimise it all for you?
Or, am I asking the wrong question entirely?
© Stack Overflow or respective owner