From c7663483a6cb1c335630ae2efc62183d9a875435 Mon Sep 17 00:00:00 2001 From: Kevin Gibbons Date: Sun, 28 Jan 2024 15:18:09 -0800 Subject: [PATCH] Editorial: factor out SetUint8ArrayBytes --- spec.html | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/spec.html b/spec.html index 456b256..25482c5 100644 --- a/spec.html +++ b/spec.html @@ -91,13 +91,7 @@

Uint8Array.fromBase64Into ( _string_, _into_ [ , _options_ ] )

1. Let _written_ be the length of _bytes_. 1. NOTE: FromBase64 does not invoke any user code, so the ArrayBuffer backing _into_ cannot have been detached or shrunk. 1. Assert: _written_ ≤ _byteLength_. - 1. Let _offset_ be _into_.[[ByteOffset]]. - 1. Let _index_ be 0. - 1. Repeat, while _index_ < _written_, - 1. Let _byte_ be _bytes_[_index_]. - 1. Let _byteIndexInBuffer_ be _index_ + _offset_. - 1. Perform SetValueInBuffer(_into_.[[ViewedArrayBuffer]], _byteIndexInBuffer_, ~uint8~, 𝔽(_byte_), *true*, ~unordered~). - 1. Set _index_ to _index_ + 1. + 1. Perform SetUint8ArrayBytes(_into_, _bytes_). 1. Let _resultObject_ be OrdinaryObjectCreate(%Object.prototype%). 1. Perform ! CreateDataPropertyOrThrow(_resultObject_, *"read"*, 𝔽(_result_.[[Read]])). 1. Perform ! CreateDataPropertyOrThrow(_resultObject_, *"written"*, 𝔽(_written_)). @@ -131,13 +125,7 @@

Uint8Array.fromHexInto ( _string_, _into_ )

1. Let _written_ be the length of _bytes_. 1. NOTE: FromHex does not invoke any user code, so the ArrayBuffer backing _into_ cannot have been detached or shrunk. 1. Assert: _written_ ≤ _byteLength_. - 1. Let _offset_ be _into_.[[ByteOffset]]. - 1. Let _index_ be 0. - 1. Repeat, while _index_ < _written_, - 1. Let _byte_ be _bytes_[_index_]. - 1. Let _byteIndexInBuffer_ be _index_ + _offset_. - 1. Perform SetValueInBuffer(_into_.[[ViewedArrayBuffer]], _byteIndexInBuffer_, ~uint8~, 𝔽(_byte_), *true*, ~unordered~). - 1. Set _index_ to _index_ + 1. + 1. Perform SetUint8ArrayBytes(_into_, _bytes_). 1. Let _resultObject_ be OrdinaryObjectCreate(%Object.prototype%). 1. Perform ! CreateDataPropertyOrThrow(_resultObject_, *"read"*, 𝔽(_result_.[[Read]])). 1. Perform ! CreateDataPropertyOrThrow(_resultObject_, *"written"*, 𝔽(_written_)). @@ -183,6 +171,26 @@

+ +

+ SetUint8ArrayBytes ( + _into_: a Uint8Array, + _bytes_: a List of byte values + ): ~unused~ +

+
+ + 1. Let _offset_ be _into_.[[ByteOffset]]. + 1. Let _len_ be the length of _bytes_. + 1. Let _index_ be 0. + 1. Repeat, while _index_ < _len_, + 1. Let _byte_ be _bytes_[_index_]. + 1. Let _byteIndexInBuffer_ be _index_ + _offset_. + 1. Perform SetValueInBuffer(_into_.[[ViewedArrayBuffer]], _byteIndexInBuffer_, ~uint8~, 𝔽(_byte_), *true*, ~unordered~). + 1. Set _index_ to _index_ + 1. + +
+

Helpers