Nobody said that addition is any better than OR.
It doesn't matter which one you use, there is no impact on performance, since it's different performance on different platforms.
So I don't see what you guys arguing about.
|
|

Bitwise operation - Wikipedia, the free encyclopedia
"It is a fast, primitive action directly supported by the processor, and is used to manipulate values for comparisons and calculations." ... "the latter may still be optimal for overall power/performance due to lower resource use."
Btw you must have a different JDK because, there is no such thing as "java.nio.ByteBufferHelper" in Sun JDK, they all use java.nio.Bits lol (which uses or...)
Found in java.nio.Bits:
Code:static private int makeInt(byte b3, byte b2, byte b1, byte b0) { return (((b3 ) << 24) | ((b2 & 0xff) << 16) | ((b1 & 0xff) << 8) | ((b0 & 0xff) )); }

Nobody said that addition is any better than OR.
It doesn't matter which one you use, there is no impact on performance, since it's different performance on different platforms.
So I don't see what you guys arguing about.

why are you people so arrogant to use addition? i really could care less if you use OR or addition. OR has 2 advantages over addition, addition has NONE. there are no advantages of using addition over OR, only possibility for disadvantage.
there is never going to be better performance with addition unless the processor is specifically built for it
Advantages of using OR:
1. Possibly much much faster, but in new processors it might just be a little bit faster
2. Less power consumption! (LESS CIRCUITRY!!!)
Advantages of using Add:
NONE!
In fact using addition in these kinds of situations is just dumb because it makes it more difficult to remove and manage bits.
I found a nice discussion for you, scroll to the second post: best practices - Bitwise-OR vs Adding Flags - Programmers - Stack Exchange
@a previous post by iKilem: actually x86 instructions have a lot in common with Java bytecode..incase you didn't know...btw ever heard of JIT?
Now would all PLEASE stop arguing for this, there is no reason to! there is NO advantage of using ADDITION rather than OR, unless you are dumb and don't know how OR works lol (so you wouldn't think to use it or know how...)
UNLESS YOU HAVE SOMETHING INTELLIGENT TO SAY AND HAVE EVIDENCE TO BACK IT UP DON'T POST BECAUSE I WILL NOT RESPOND ANYMORE!

Use what suits you, alright.
I would use OR myself in that case, but don't compare them unless you know how stuff works on processor level.
Now Jagex also using it for a reason, not saying that Add has any advantages over OR, just maybe they used Add in the past and cba to change it.

Holy dick fuck, they are just different opcodes as far as Java bytecode is concerned. One isn't simpler than the other in that sense. Maybe for the processor this is the case, but as I've been saying throughout this thread, that shouldn't really concern a Java programmer (unless it's clearly something to think about, which it isn't). Are you too stupid to understand that? You and Killer 99 are just looking at it from a different perspective and are taking it way out of proportion.
It says in the source that it's from GNU Classpath.
Platform-dependant mate.
That's a fair argument.
... well, there are a handful of instructions that are the same in terms of functionality, but not how the processor deals with those instructions obviously, so I don't see what your point is.
No one's saying addition is better than using OR. I'm sure I mentioned that as well.

you think java bytecode isn't executed in x86 instructions, what are you, stupid?
like i said, you are using openjdk or something.
like i said, it depends on the processor make
.
i gave you the advantages, now what are the advantages of using addition? that could answer the question i originally posed, so far...no one has stated or brought up any advantages of using addition..................................

If I'm on my smart phone which has an ARM processor, nope, there's no x86 involved.
Like I said, it's from GNU Classpath. I never said anything about using it, though. I just linked you to something I found on the web.
Yeah, it depends on the processor which is what I've been saying, hence why the advantages you listed aren't really relevant.
... how many times do I have to say I'm not recommending addition over bitwise OR? There are no advantages.
| « What do you prefer? | 317 Interface System "Scripts" » |
| Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |