ws-cleanup: codecs/compress/PackBits; UTF-16 and half floats from one place
- codecs/compress/PackBits (new, from image/tiff/Pixels): decode (lenient count + a clean flag for strict callers) and encode; image/tiff and layered/psd (which carried its own decoder) use it. tests/codecs/packbits. - codecs/text/Text.utf16(buf, offset, length, bigEndian?): the UTF-16 -> UTF-8 conversion codecs/font/TrueType, archive/7z and layered/psd each wrote (lone surrogates -> U+FFFD everywhere now). - image/tiff/Pixels and data/cbor use core/Bytes.half instead of their own float16 decoders. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
434a304315
commit
9bcf061338
13 files changed
+191
-178
No files matched your search
@@ -142,17 +142,7 @@ local function chunks(st: St, major: number, depth: number): (string?, string?)
|
||||
end
|
||||
end
|
||||
|
||||
local function half(h: number): number
|
||||
local s = if h >= 32768 then -1 else 1
|
||||
local e = (h // 1024) % 32
|
||||
local m = h % 1024
|
||||
if e == 0 then
|
||||
return s * m * 2 ^ -24
|
||||
elseif e == 31 then
|
||||
return if m == 0 then s * math.huge else 0 / 0
|
||||
end
|
||||
return s * (1 + m / 1024) * 2 ^ (e - 15)
|
||||
end
|
||||
local half = Bytes.half
|
||||
|
||||
local function tag(st: St, t: number, v: any): (any, string?)
|
||||
if t == 0 and st.dates then
|
||||
|
||||
Reference in new issue
Block a user