Differences From
Artifact [1d1d177061]:
224 224 var sz: intptr = 0
225 225 for i = 0, f.ct do
226 226 if f(i) == @',' then goto skip end
227 227 if f(i) >= 0x30 and f(i) <= 0x39 then
228 228 sz = sz * 10
229 229 sz = sz + f(i) - 0x30
230 230 else
231 - if i+1 == f.ct or f(i) == 0 then return sz, true end
232 - if i+2 == f.ct or f(i+1) == 0 then
231 + if i+0 == f.ct or f(i) == 0 then return sz, true end
232 + if i+1 == f.ct or f(i+1) == 0 then
233 233 if f(i) == @'b' then return sz/8, true end -- bits
234 234 else
235 235 var s: intptr = 0
236 - if i+3 == f.ct or f(i+2) == 0 then
236 + if i+2 == f.ct or f(i+2) == 0 then
237 237 s = i + 1
238 - elseif (i+4 == f.ct or f(i+3) == 0) and f(i+1) == @'i' then
238 + elseif (i+3 == f.ct or f(i+3) == 0) and f(i+1) == @'i' then
239 239 -- grudgingly tolerate ~mebibits~ and its ilk, without
240 240 -- affecting the result in any way
241 241 s = i + 2
242 242 else return 0, false end
243 243
244 244 if f(s) == @'b' then sz = sz/8 -- bits
245 245 elseif f(s) ~= @'B' then return 0, false end -- wth
246 246 end
247 247 var c = f(i)
248 - if c >= @'A' and c <= @'Z' then c = c - 0x20 end
248 + if c >= @'A' and c <= @'Z' then c = c + 0x20 end
249 249 switch c do -- normal char literal syntax doesn't work here, leads to llvm error (!!)
250 250 case [uint8]([string.byte('k')]) then return sz * [1024ULL ^ 1], true end
251 251 case [uint8]([string.byte('m')]) then return sz * [1024ULL ^ 2], true end
252 252 case [uint8]([string.byte('g')]) then return sz * [1024ULL ^ 3], true end
253 253 case [uint8]([string.byte('t')]) then return sz * [1024ULL ^ 4], true end
254 - case [uint8]([string.byte('e')]) then return sz * [1024ULL ^ 5], true end
255 - case [uint8]([string.byte('y')]) then return sz * [1024ULL ^ 6], true end
256 - else return sz, true
254 + case [uint8]([string.byte('p')]) then return sz * [1024ULL ^ 5], true end
255 + case [uint8]([string.byte('e')]) then return sz * [1024ULL ^ 6], true end
256 + case [uint8]([string.byte('z')]) then return sz * [1024ULL ^ 7], true end
257 + case [uint8]([string.byte('y')]) then return sz * [1024ULL ^ 8], true end
258 + else return 0, false
257 259 end
258 260 end
259 261 ::skip::end
260 262 return sz, true
261 263 end
262 264
263 265 return m