diff options
| author | Evan Haas <evan@lagerdata.com> | 2021-03-03 19:53:48 -0800 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2021-03-05 14:16:40 +0200 |
| commit | 291edafa1b3e6f56f88c3d1c542bdb25e99e45d1 (patch) | |
| tree | 943031717a44342403e63b6b957fd04332edbbd7 /src/Cache.zig | |
| parent | 02737d535ac5bda4e9a00ec0ae11ae313065dfbb (diff) | |
| download | zig-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/Cache.zig')
0 files changed, 0 insertions, 0 deletions
