Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Rant

Rant

Scheduled Pinned Locked Moved The Lounge
javahtmlcom
9 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    KP Lee
    wrote on last edited by
    #1

    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)

    L OriginalGriffO D 3 Replies Last reply
    0
    • K KP Lee

      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)

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      40 % 32 means 40 mod[^] 32 which is 8.

      K realJSOPR 3 Replies Last reply
      0
      • K KP Lee

        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)

        OriginalGriffO Offline
        OriginalGriffO Offline
        OriginalGriff
        wrote on last edited by
        #3

        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."

        "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
        "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

        K 1 Reply Last reply
        0
        • K KP Lee

          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)

          D Offline
          D Offline
          David1987
          wrote on last edited by
          #4

          I think it's the expectation that's wrong here..

          K 1 Reply Last reply
          0
          • L Lost User

            40 % 32 means 40 mod[^] 32 which is 8.

            K Offline
            K Offline
            KP Lee
            wrote on last edited by
            #5

            You're right, I mixed up "or" (||) results with remainder results in my head. Complaint about how comments are posted remain even if I'm totally wrong in my comment.

            1 Reply Last reply
            0
            • OriginalGriffO OriginalGriff

              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."

              K Offline
              K Offline
              KP Lee
              wrote on last edited by
              #6

              Mea culpa.

              1 Reply Last reply
              0
              • D David1987

                I think it's the expectation that's wrong here..

                K Offline
                K Offline
                KP Lee
                wrote on last edited by
                #7

                Mea culpa.

                1 Reply Last reply
                0
                • L Lost User

                  40 % 32 means 40 mod[^] 32 which is 8.

                  K Offline
                  K Offline
                  KP Lee
                  wrote on last edited by
                  #8

                  This is a good night for screwing up. The "or" I was thinking of was (|) and I should have wanted "and" (&)

                  1 Reply Last reply
                  0
                  • L Lost User

                    40 % 32 means 40 mod[^] 32 which is 8.

                    realJSOPR Offline
                    realJSOPR Offline
                    realJSOP
                    wrote on last edited by
                    #9

                    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, 1997

                    modified on Saturday, July 23, 2011 9:30 AM

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups