# translate-c: better codegen for pointer index by int literal · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/bc18e93825f1f3703b97590cc0e963b3faa8cd3e)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: bc18e93825f1f3703b97590cc0e963b3faa8cd3e

Requested commit: bc18e93825f1f3703b97590cc0e963b3faa8cd3e

Commit: bc18e93825f1f3703b97590cc0e963b3faa8cd3e

Tree: d4a2776c0b1f9bf65b135aa6a203ea28b32d195e

Author: Evan Haas

Committer: Veikka Tuominen

## Message

```
translate-c: better codegen for pointer index by int literal

#8589 introduced correct handling of signed (possibly negative) array access
of pointers. Since unadorned integer literals in C are signed, this resulted
in inefficient generated code when indexing a pointer by a non-negative
integer literal.

```

## Parents

- [41d7787b69a437e21351d103353fc2eefafb5d17](https://git.cafe/gitcafe/zig/commit/41d7787b69a437e21351d103353fc2eefafb5d17?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/bc18e93825f1f3703b97590cc0e963b3faa8cd3e?format=markdown)
