javascript-tutorial / javascript-tutorial/en.javascript.info
Mention endianness and alignment in section ArrayBuffers, binary arrays
- 主要語言
- HTML
- 星號
- 25.5k
- 分支
- 4k
- PR 合併指標
- 30 天內沒有已合併 PR
描述
* Alignment: My browser (Firefox 87.0 on Linux x86_64) doesn't let me create an unaligned Uint16Array. I. e., `new Uint16Array(b, 1, 1)` on a 4-byte array buffer gives `RangeError: attempting to construct out-of-bounds TypedArray on ArrayBuffer`. In the standard that is [22.2.1.5](https://262.ecma-international.org/6.0/#sec-%typedarray%-buffer-byteoffset-length).13a.
* Endianness: Uint16Array is little-endian on my machine. I just learned that this is machine dependent ([https://stackoverflow.com/questions/7869752/javascript-typed-arrays-and-endianness](Stackoverflow)). In contrast, `dataView.getUint16()` is big-endian, unless the second argument is true.
Hope this helps.
貢獻指南
這個儲存庫沒有索引到貢獻指南
研究方向
找到標題為「ArrayBuffers, binary arrays」的教學區段,並檢視其中關於型別化陣列和 DataView 的現有說明。加入清楚的註記,涵蓋 issue 中描述的對齊限制和位元組順序差異,包括 Uint16Array 和 dataView.getUint16() 的相關行為。當讀者能夠從該區段理解這兩個注意事項時,即可視為完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- javascript
- 領域
- documentation
- Issue 類型
- 文件
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 65/100