Rant
-
Codeproject linked to java-all-about-64-bit-programming[^] without comments. Tried to add one. Had to belong to a list of various sources. None of which I belong to. Arrg. My comment about their article was for a line of code:"long i = 1 << (40 % 32);" would result in 1. No bit shift would occur because a 32 bit shift would have the same effect as a 0 bit shift and that is what 40%32 is.(a 32 bit shift) "long i = 1 << (40 % 31);" is needed to get the 256 expected result. (8 is the result of 40 % 31)
-
Codeproject linked to java-all-about-64-bit-programming[^] without comments. Tried to add one. Had to belong to a list of various sources. None of which I belong to. Arrg. My comment about their article was for a line of code:"long i = 1 << (40 % 32);" would result in 1. No bit shift would occur because a 32 bit shift would have the same effect as a 0 bit shift and that is what 40%32 is.(a 32 bit shift) "long i = 1 << (40 % 31);" is needed to get the 256 expected result. (8 is the result of 40 % 31)
-
Codeproject linked to java-all-about-64-bit-programming[^] without comments. Tried to add one. Had to belong to a list of various sources. None of which I belong to. Arrg. My comment about their article was for a line of code:"long i = 1 << (40 % 32);" would result in 1. No bit shift would occur because a 32 bit shift would have the same effect as a 0 bit shift and that is what 40%32 is.(a 32 bit shift) "long i = 1 << (40 % 31);" is needed to get the 256 expected result. (8 is the result of 40 % 31)
KP Lee wrote:
My comment about their article was for a line of code:"long i = 1 << (40 % 32);"
would result in 1. No bit shift would occur because a 32 bit shift would have the same effect as a 0 bit shift and that is what 40%32 is.(a 32 bit shift)Where did you get that idea from?
long i = 1 << (40 % 32);
Is 256
long i = 1 << (40 % 31);
Is 512
long i = 40 % 32;
Is 8
long i = 40 % 31;
Is 9
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."
-
Codeproject linked to java-all-about-64-bit-programming[^] without comments. Tried to add one. Had to belong to a list of various sources. None of which I belong to. Arrg. My comment about their article was for a line of code:"long i = 1 << (40 % 32);" would result in 1. No bit shift would occur because a 32 bit shift would have the same effect as a 0 bit shift and that is what 40%32 is.(a 32 bit shift) "long i = 1 << (40 % 31);" is needed to get the 256 expected result. (8 is the result of 40 % 31)
-
KP Lee wrote:
My comment about their article was for a line of code:"long i = 1 << (40 % 32);"
would result in 1. No bit shift would occur because a 32 bit shift would have the same effect as a 0 bit shift and that is what 40%32 is.(a 32 bit shift)Where did you get that idea from?
long i = 1 << (40 % 32);
Is 256
long i = 1 << (40 % 31);
Is 512
long i = 40 % 32;
Is 8
long i = 40 % 31;
Is 9
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."
-
But why are they doing the mod operation? They're not using variables, so it would have been better to just say
1<<8
. It's java so it's already stupid, but that just more or less confirms that it's stupid. In fact, why do the unnecessary shift left operation at all? They're just being ass-hats at this point.".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997modified on Saturday, July 23, 2011 9:30 AM