second, what is big and small end
The definitions of Big-endian and Little-endian are as follows:
1) Little-endian is the low byte emissions in the memory of the lower address, high-byte emissions at the high address of the memory.
2) Big-endian is the high-bit bytes emitted at the low address of the memory, low bytes emitted in the memory of the higher address.
For example, for example, digital 0x12 34 56 78 is represented in memory:
1) Big-endian mode:
Low address-----------------> High address
0x12 | 0x34 | 0x56 | 0x78
2) Small terminal mode:
Low address------------------> High address
0x78 | 0x56 | 0x34 | 0x12
It can be seen that the big-endian pattern is similar to string storage.
3) Here are two specific examples:
The 16bit wide number of 0x1234 in Little-endian mode (and Big-endian mode) in CPU memory (assuming storage from address 0x4000) is:
Memory address |
Small Terminal mode storage content |
Store content in big-endian mode |
0x4000 |
0x34 |
0x12 |
0x4001 |
0x12 |
0x34 |
32bit wide number of 0x12345678 in Little-endian mode and Big-endian mode) in CPU memory (assuming that the store starts from the address 0x4000) is:
Memory address |
Small Terminal mode storage content |
Store content in big-endian mode |
0x4000 |
0x78 |
0x12 |
0x4001 |
0x56 |
0x34 |
0x4002 |
0x34 |
0x56 |
0x4003 |
0x12 |
0x78 |
C # code
intx =439041118;//16 binary to 1a2b3c5estrings =NULL;byte[] B =bitconverter.getbytes (x); s= Bitconverter.tostring (b);//Small terminal modeConsole.WriteLine (s);//small end output is 5e-3c-2b-1aArray.reverse (b);//reversals= Bitconverter.tostring (b);//Big- endian modeConsole.WriteLine ("{0:x}", s);//Big -endian output is 1a-2b-3c-5eConsole.readkey ();
C # small end to big Endian Little Endian