Re: [whatwg/encoding] Editorial: revamp the way we deal with code points and bytes (#247)

@andreubotella commented on this pull request.



>  
- <li><p>Return a code point whose value is 0xF780 + <var>byte</var> &minus; 0x80.
+ <li><p>If <var>byte</var> is an <a>ASCII byte</a>, then return a <a>code point</a> whose
+ <a for="code point">value</a> is <var>byteValue</var>.
+
+ <li><p>Return a <a>code point</a> whose <a for="code point">value</a> is
+ 0xF780 + <var>byteValue</var> &minus; 0x80.

We could define implicit conversions code point → number and byte → number (whatwg/infra#319) and perhaps the other way around too. But even if we don't, we could use short algorithmic phrases inside the formula: "0xF780 + (byte's value) &minus; 0x80".

There are other formulas in the standard that use byte or code point values directly, though, and they should be changed accordingly. (Interestingly, there are formulas dealing with code units around TextEncoder and TextEncoderStream, which don't have this problem because code units seem to be defined directly as a number type.)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/encoding/pull/247#discussion_r516515590

Received on Tuesday, 3 November 2020 09:11:15 UTC