Skip to content

Commit

Permalink
Misc editorial fixes (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
anba authored Jan 22, 2024
1 parent 0baee1a commit 17fac7b
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ <h1>Uint8Array.prototype.toHex ( )</h1>
1. Let _toEncode_ be ? GetUint8ArrayBytes(_O_).
1. Let _out_ be the empty String.
1. For each byte _byte_ of _toEncode_, do
1. Let _hex_ be Number::toString(_byte_, 16).
1. Set _hex_ to StringPad(_hex_, 2, "0", ~start~).
1. Let _hex_ be Number::toString(𝔽(_byte_), 16).
1. Set _hex_ to StringPad(_hex_, 2, *"0"*, ~start~).
1. Set _out_ to the string-concatenation of _out_ and _hex_.
1. Return _out_.
</emu-alg>
Expand All @@ -63,8 +63,8 @@ <h1>Uint8Array.fromBase64 ( _string_ [ , _options_ ] )</h1>
1. If _lastChunkHandling_ is not one of *"loose"*, *"strict"*, or *"stop-before-partial"*, throw a *TypeError* exception.
1. Let _result_ be ? FromBase64(_string_, _alphabet_, _lastChunkHandling_).
1. Let _resultLength_ be the length of _result_.[[Bytes]].
1. Let _ta_ be ? <emu-meta suppress-effects="user-code">AllocateTypedArray(*"Uint8Array"*, %Uint8Array%, %Uint8Array.prototype%, _resultLength_)</emu-meta>.
1. Set the value at each index of _ta_.[[ViewedArrayBuffer]].[[ArrayBufferData]] to the value at the corresponding index of _ta_.[[Bytes]].
1. Let _ta_ be ? <emu-meta suppress-effects="user-code">AllocateTypedArray(*"Uint8Array"*, %Uint8Array%, *"%Uint8Array.prototype%"*, _resultLength_)</emu-meta>.
1. Set the value at each index of _ta_.[[ViewedArrayBuffer]].[[ArrayBufferData]] to the value at the corresponding index of _result_.[[Bytes]].
1. Return _ta_.
</emu-alg>
</emu-clause>
Expand All @@ -73,8 +73,7 @@ <h1>Uint8Array.fromBase64 ( _string_ [ , _options_ ] )</h1>
<h1>Uint8Array.fromBase64Into ( _string_, _into_ [ , _options_ ] )</h1>
<emu-alg>
1. If _string_ is not a String, throw a *TypeError* exception.
1. Perform ? RequireInternalSlot(_into_, [[TypedArrayName]]).
1. If _into_.[[TypedArrayName]] is not *"Uint8Array"*, throw a *TypeError* exception.
1. Perform ? ValidateUint8Array(_into_).
1. Let _opts_ be ? GetOptionsObject(_options_).
1. Let _alphabet_ be ? Get(_opts_, *"alphabet"*).
1. If _alphabet_ is *undefined*, set _alphabet_ to *"base64"*.
Expand All @@ -98,8 +97,8 @@ <h1>Uint8Array.fromBase64Into ( _string_, _into_ [ , _options_ ] )</h1>
1. Let _byteIndexInBuffer_ be _index_ + _offset_.
1. Perform SetValueInBuffer(_into_.[[ViewedArrayBuffer]], _byteIndexInBuffer_, ~uint8~, 𝔽(_byte_), *true*, ~unordered~).
1. Let _resultObject_ be OrdinaryObjectCreate(%Object.prototype%).
1. Perform ! CreateDataPropertyOrThrow(_resultObject_, *"read"*, _result_.[[Read]]).
1. Perform ! CreateDataPropertyOrThrow(_resultObject_, *"written"*, _written_).
1. Perform ! CreateDataPropertyOrThrow(_resultObject_, *"read"*, 𝔽(_result_.[[Read]])).
1. Perform ! CreateDataPropertyOrThrow(_resultObject_, *"written"*, 𝔽(_written_)).
1. Return _resultObject_.
</emu-alg>
</emu-clause>
Expand All @@ -110,8 +109,8 @@ <h1>Uint8Array.fromHex ( _string_ )</h1>
1. If _string_ is not a String, throw a *TypeError* exception.
1. Let _result_ be ? FromHex(_string_).
1. Let _resultLength_ be the length of _result_.[[Bytes]].
1. Let _ta_ be ? <emu-meta suppress-effects="user-code">AllocateTypedArray(*"Uint8Array"*, %Uint8Array%, %Uint8Array.prototype%, _resultLength_)</emu-meta>.
1. Set the value at each index of _ta_.[[ViewedArrayBuffer]].[[ArrayBufferData]] to the value at the corresponding index of _ta_.[[Bytes]].
1. Let _ta_ be ? <emu-meta suppress-effects="user-code">AllocateTypedArray(*"Uint8Array"*, %Uint8Array%, *"%Uint8Array.prototype%"*, _resultLength_)</emu-meta>.
1. Set the value at each index of _ta_.[[ViewedArrayBuffer]].[[ArrayBufferData]] to the value at the corresponding index of _result_.[[Bytes]].
1. Return _ta_.
</emu-alg>
</emu-clause>
Expand All @@ -120,8 +119,7 @@ <h1>Uint8Array.fromHex ( _string_ )</h1>
<h1>Uint8Array.fromHexInto ( _string_, _into_ )</h1>
<emu-alg>
1. If _string_ is not a String, throw a *TypeError* exception.
1. Perform ? RequireInternalSlot(_into_, [[TypedArrayName]]).
1. If _into_.[[TypedArrayName]] is not *"Uint8Array"*, throw a *TypeError* exception.
1. Perform ? ValidateUint8Array(_into_).
1. Let _taRecord_ be MakeTypedArrayWithBufferWitnessRecord(_into_, ~seq-cst~).
1. Let _byteLength_ be TypedArrayByteLength(_taRecord_).
1. Let _maxLength_ be _byteLength_.
Expand All @@ -137,8 +135,8 @@ <h1>Uint8Array.fromHexInto ( _string_, _into_ )</h1>
1. Let _byteIndexInBuffer_ be _index_ + _offset_.
1. Perform SetValueInBuffer(_into_.[[ViewedArrayBuffer]], _byteIndexInBuffer_, ~uint8~, 𝔽(_byte_), *true*, ~unordered~).
1. Let _resultObject_ be OrdinaryObjectCreate(%Object.prototype%).
1. Perform ! CreateDataPropertyOrThrow(_resultObject_, *"read"*, _result_.[[Read]]).
1. Perform ! CreateDataPropertyOrThrow(_resultObject_, *"written"*, _written_).
1. Perform ! CreateDataPropertyOrThrow(_resultObject_, *"read"*, 𝔽(_result_.[[Read]])).
1. Perform ! CreateDataPropertyOrThrow(_resultObject_, *"written"*, 𝔽(_written_)).
1. Return _resultObject_.
</emu-alg>
</emu-clause>
Expand Down

0 comments on commit 17fac7b

Please sign in to comment.