Converting byte array (char array) to an integer type (short, int, long)

前端 未结 5 1424
名媛妹妹
名媛妹妹 2020-12-08 11:35

I was wondering if system endianness matters when converting a byte array to a short / int / long. Would this be incorrect to do if the code runs on both big-endian and litt

5条回答
  •  天命终不由人
    2020-12-08 12:39

    No, that's fine as far as endianness is concerned, but you may have problems if your ints are only 16 bits wide.

提交回复
热议问题