zoukankan      html  css  js  c++  java
  • 字节序之大小端_Intelx86是小端_网络传输是大端

    大端、小端、大小端
     
    数据:0x12345678
     

    大端模式 - Big Endian

     
    低地址存放最高有效字节(MSB->LSB)
     
       低地址                                            高地址
       ----------------------------------------->
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |     12     |      34    |     56      |     78    |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     
    使用:
    网络字节序;(网络先发送低地址的高位数据)
    PowerPC;
    HP-PA的UNIX操作系统
    JAVA
     
    小端模式 - Littile Endian
     
    低地址存放最低有效字节(LSB->MSB)
     
       低地址                                            高地址
       ----------------------------------------->
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |     78     |      56    |     34      |     12    |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     
    使用:
    Intel x86
    ARM
    Alpha
    HP-PA的NT操作系统
     
    转换
    网络与主机字节转换函数:htons ntohs htonl ntohl (s 就是short l是long h是host n是network)
     
     
    参考

  • 相关阅读:
    814. Binary Tree Pruning
    50. Pow(x, n)
    698. Partition to K Equal Sum Subsets
    416. Partition Equal Subset Sum
    150. Evaluate Reverse Polish Notation
    322. Coin Change
    Vulnerable Kerbals CodeForces
    D. Domino for Young
    C. Long Beautiful Integer
    B. Modulo Equality
  • 原文地址:https://www.cnblogs.com/microwave/p/14532039.html
Copyright © 2011-2022 走看看