| ... | ... | @@ -1460,7 +1460,7 @@ fn parseFormValueConstant(allocator: *mem.Allocator, in_stream: var, signed: boo |
| 1460 | 1460 | 2 => try in_stream.readIntLittle(u16), |
| 1461 | 1461 | 4 => try in_stream.readIntLittle(u32), |
| 1462 | 1462 | 8 => try in_stream.readIntLittle(u64), |
| 1463 | | -1 => if (signed) @intCast(u64, try readILeb128(in_stream)) else try readULeb128(in_stream), |
| 1463 | -1 => if (signed) @bitCast(u64, try readILeb128(in_stream)) else try readULeb128(in_stream), |
| 1464 | 1464 | else => @compileError("Invalid size"), |
| 1465 | 1465 | }, |
| 1466 | 1466 | }, |
| ... | ... | @@ -2272,14 +2272,15 @@ fn readILeb128Mem(ptr: *[*]const u8) !i64 { |
| 2272 | 2272 | const byte = ptr.*[i]; |
| 2273 | 2273 | i += 1; |
| 2274 | 2274 | |
| 2275 | | var operand: i64 = undefined; |
| 2276 | | if (@shlWithOverflow(i64, byte & 0b01111111, @intCast(u6, shift), &operand)) return error.InvalidDebugInfo; |
| 2275 | if (shift > @sizeOf(i64) * 8) return error.InvalidDebugInfo; |
| 2277 | 2276 | |
| 2278 | | result |= operand; |
| 2277 | result |= i64(byte & 0b01111111) << @intCast(u6, shift); |
| 2279 | 2278 | shift += 7; |
| 2280 | 2279 | |
| 2281 | 2280 | if ((byte & 0b10000000) == 0) { |
| 2282 | | if (shift < @sizeOf(i64) * 8 and (byte & 0b01000000) != 0) result |= -(i64(1) << @intCast(u6, shift)); |
| 2281 | if (shift < @sizeOf(i64) * 8 and (byte & 0b01000000) != 0) { |
| 2282 | result |= -(i64(1) << @intCast(u6, shift)); |
| 2283 | } |
| 2283 | 2284 | ptr.* += i; |
| 2284 | 2285 | return result; |
| 2285 | 2286 | } |
| ... | ... | @@ -2323,15 +2324,15 @@ fn readILeb128(in_stream: var) !i64 { |
| 2323 | 2324 | while (true) { |
| 2324 | 2325 | const byte = try in_stream.readByte(); |
| 2325 | 2326 | |
| 2326 | | var operand: i64 = undefined; |
| 2327 | | |
| 2328 | | if (@shlWithOverflow(i64, byte & 0b01111111, @intCast(u6, shift), &operand)) return error.InvalidDebugInfo; |
| 2327 | if (shift > @sizeOf(i64) * 8) return error.InvalidDebugInfo; |
| 2329 | 2328 | |
| 2330 | | result |= operand; |
| 2329 | result |= i64(byte & 0b01111111) << @intCast(u6, shift); |
| 2331 | 2330 | shift += 7; |
| 2332 | 2331 | |
| 2333 | 2332 | if ((byte & 0b10000000) == 0) { |
| 2334 | | if (shift < @sizeOf(i64) * 8 and (byte & 0b01000000) != 0) result |= -(i64(1) << @intCast(u6, shift)); |
| 2333 | if (shift < @sizeOf(i64) * 8 and (byte & 0b01000000) != 0) { |
| 2334 | result |= -(i64(1) << @intCast(u6, shift)); |
| 2335 | } |
| 2335 | 2336 | return result; |
| 2336 | 2337 | } |
| 2337 | 2338 | } |