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. General Programming
  3. C#
  4. Little Endian vs Big Endian [modified]

Little Endian vs Big Endian [modified]

Scheduled Pinned Locked Moved C#
questioncsharpvisual-studiohelp
7 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.
  • S Offline
    S Offline
    seq
    wrote on last edited by
    #1

    Hey guyz! I have a question how do I change in C# a number from such B8B80C00 byte-ordering into such one: 000CB8B8 Any help would be appreciated.. Regards, Pawel -- modified at 14:24 Wednesday 2nd August, 2006

    D E E 3 Replies Last reply
    0
    • S seq

      Hey guyz! I have a question how do I change in C# a number from such B8B80C00 byte-ordering into such one: 000CB8B8 Any help would be appreciated.. Regards, Pawel -- modified at 14:24 Wednesday 2nd August, 2006

      D Offline
      D Offline
      Drew McGhie
      wrote on last edited by
      #2

      Try spelling it right. its "endian," referring to the end of the significant bit. A quick google search should do you just fine. -- modified at 14:19 Wednesday 2nd August, 2006

      G 1 Reply Last reply
      0
      • S seq

        Hey guyz! I have a question how do I change in C# a number from such B8B80C00 byte-ordering into such one: 000CB8B8 Any help would be appreciated.. Regards, Pawel -- modified at 14:24 Wednesday 2nd August, 2006

        E Offline
        E Offline
        Ennis Ray Lynch Jr
        wrote on last edited by
        #3

        The IPAddress class provides methods with that functionality for several types.

        A man said to the universe: "Sir I exist!" "However," replied the Universe, "The fact has not created in me A sense of obligation." -- Stephen Crane

        S 1 Reply Last reply
        0
        • E Ennis Ray Lynch Jr

          The IPAddress class provides methods with that functionality for several types.

          A man said to the universe: "Sir I exist!" "However," replied the Universe, "The fact has not created in me A sense of obligation." -- Stephen Crane

          S Offline
          S Offline
          seq
          wrote on last edited by
          #4

          ok guyz thx for the answer I found on google what I was looking for.. before that I couldnt find because I spelt it incorrect ;] thx for help anyway

          1 Reply Last reply
          0
          • S seq

            Hey guyz! I have a question how do I change in C# a number from such B8B80C00 byte-ordering into such one: 000CB8B8 Any help would be appreciated.. Regards, Pawel -- modified at 14:24 Wednesday 2nd August, 2006

            E Offline
            E Offline
            engsrini
            wrote on last edited by
            #5

            string str = "000CB8B8"; char[] ch=str.ToCharArray(); string strev = ""; for (int i = (ch.Length-1); i >= 0; i--) { strev += ch[i].ToString(); } reversed string will be on strev

            G 1 Reply Last reply
            0
            • E engsrini

              string str = "000CB8B8"; char[] ch=str.ToCharArray(); string strev = ""; for (int i = (ch.Length-1); i >= 0; i--) { strev += ch[i].ToString(); } reversed string will be on strev

              G Offline
              G Offline
              Guffa
              wrote on last edited by
              #6

              Reversing the nibbles won't correctly change the endianess of the number. You have to reverse the bytes:

              string number = "000CB8B8";

              string swapped = string.Empty;
              for (int i = number.Length - 2; i >= 0; i -= 2) {
              swapped += number.Substring(i, 2);
              }

              --- b { font-weight: normal; }

              1 Reply Last reply
              0
              • D Drew McGhie

                Try spelling it right. its "endian," referring to the end of the significant bit. A quick google search should do you just fine. -- modified at 14:19 Wednesday 2nd August, 2006

                G Offline
                G Offline
                Guffa
                wrote on last edited by
                #7

                "Mmmmmm. Juicy Fruit." -- Big indian (Chief Bromden) ;)

                --- b { font-weight: normal; }

                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