Skip to content

Commit

Permalink
[spec] FromHex: refactor (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb authored Jan 28, 2024
1 parent 2222881 commit 49ad7cf
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -332,14 +332,12 @@ <h1>
1. If _length_ modulo 2 is not 0, throw a *SyntaxError* exception.
1. Let _bytes_ be « ».
1. Let _index_ be 0.
1. Repeat, while _index_ &lt; _length_,
1. Repeat, while _index_ &lt; _length_ and the length of _bytes_ &lt; _maxLength_,
1. Let _hexits_ be the substring of _string_ from _index_ to _index_ + 2.
1. If _hexits_ contains any code units which are not in *"0123456789abcdefABCDEF"*, throw a *SyntaxError* exception.
1. Set _index_ to _index_ + 2.
1. Let _byte_ be the integer value represented by _hexits_ in base-16 notation, using the letters A-F and a-f for digits with values 10 through 15.
1. Append _byte_ to _bytes_.
1. If the length of _bytes_ is _maxLength_, then
1. Return the Record { [[Read]]: _index_, [[Bytes]]: _bytes_ }.
1. Return the Record { [[Read]]: _index_, [[Bytes]]: _bytes_ }.
</emu-alg>
</emu-clause>
Expand Down

0 comments on commit 49ad7cf

Please sign in to comment.