Little-Endian Signed Integer

前端 未结 2 2126
遇见更好的自我
遇见更好的自我 2021-02-19 18:20

I know the WAV file format uses signed integers for 16-bit samples. It also stores them in little-endian order, meaning the lowest 8 bits come first, then the next, etc. Is the

2条回答
  •  耶瑟儿~
    2021-02-19 18:39

    signed int, little endian:

    byte 1(lsb)       byte 2(msb)
    ---------------------------------
    7|6|5|4|3|2|1|0 | 7|6|5|4|3|2|1|0|
    ----------------------------------
                      ^
                      | 
                     Sign bit
    

    You only need to concern yourself with that when reading/writing a short int to some external media. Within your program, the sign bit is the most significant bit in the short, no matter if you're on a big or little endian platform.

提交回复
热议问题