Data update

This commit is contained in:
Ingy döt Net 2026-04-30 12:34:36 -04:00
parent 4bb20c9b71
commit cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions

View file

@ -1,33 +1,35 @@
using Printf
mutable struct VLQ
quant::Vector{UInt8}
quant::Vector{UInt8}
end
function VLQ(n::T) where T <: Integer
quant = UInt8.(digits(n, 128))
@inbounds for i in 2:length(quant) quant[i] |= 0x80 end
VLQ(reverse(quant))
quant = UInt8.(digits(n, base = 128))
@inbounds for i in 2:lastindex(quant)
quant[i] |= 0x80
end
VLQ(reverse(quant))
end
import Base.UInt64
function Base.UInt64(vlq::VLQ)
quant = reverse(vlq.quant)
n = shift!(quant)
p = one(UInt64)
for i in quant
p *= 0x80
n += p * ( i & 0x7f)
end
return n
quant = reverse(vlq.quant)
n = popfirst!(quant)
p = one(UInt64)
for i in quant
p *= 0x80
n += p * (i & 0x7f)
end
return n
end
const test = [0x00200000, 0x001fffff, 0x00000000, 0x0000007f,
0x00000080, 0x00002000, 0x00003fff, 0x00004000,
0x08000000, 0x0fffffff]
0x00000080, 0x00002000, 0x00003fff, 0x00004000,
0x08000000, 0x0fffffff]
for i in test
vlq = VLQ(i)
j = UInt(vlq)
@printf "0x%-8x => [%-25s] => 0x%x\n" i join(("0x" * hex(r, 2) for r in vlq.quant), ", ") j
vlq = VLQ(i)
j = UInt(vlq)
@printf "0x%-8x => [%-25s] => 0x%x\n" i join(("0x" * string(r, base = 16, pad = 2) for r in vlq.quant), ", ") j
end