Little Endian vs Big Endian [modified]
-
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
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
-
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
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
-
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
-
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
-
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
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; }
-
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