javascript-tutorial / javascript-tutorial/en.javascript.info

Mention endianness and alignment in section ArrayBuffers, binary arrays

オープン 初心者向け
#2,581 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

PR wanted
主要言語
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.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

「ArrayBuffers, binary arrays」というタイトルのチュートリアルセクションを見つけ、typed array と DataView に関する既存の説明を確認してください。issue で説明されているアラインメントの制約とエンディアンの違いについて、Uint16Array と dataView.getUint16() の関連する挙動を含む、明確な注記を追加してください。そのセクションから読者がこの2つの注意点を理解できれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript
領域
documentation
issue の種類
ドキュメント
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
65/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。