aboutsummaryrefslogtreecommitdiff
path: root/src/Module.zig
diff options
context:
space:
mode:
authorEvan Haas <evan@lagerdata.com>2021-03-03 19:53:48 -0800
committerVeikka Tuominen <git@vexu.eu>2021-03-05 14:16:40 +0200
commit291edafa1b3e6f56f88c3d1c542bdb25e99e45d1 (patch)
tree943031717a44342403e63b6b957fd04332edbbd7 /src/Module.zig
parent02737d535ac5bda4e9a00ec0ae11ae313065dfbb (diff)
downloadzig-291edafa1b3e6f56f88c3d1c542bdb25e99e45d1.tar.gz
zig-291edafa1b3e6f56f88c3d1c542bdb25e99e45d1.zip
translate-c: enable pointer arithmetic with signed integer operand
Given a pointer operand `ptr` and a signed integer operand `idx` `ptr + idx` and `idx + ptr` -> ptr + @bitCast(usize, @intCast(isize, idx)) `ptr - idx` -> ptr - @bitCast(usize, @intCast(isize, idx)) Thanks @LemonBoy for pointing out that we can take advantage of wraparound to dramatically simplify the code.
Diffstat (limited to 'src/Module.zig')
0 files changed, 0 insertions, 0 deletions