# riscv: basic struct field access · gitcafe/zig

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

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

Visibility: public

Requested revision: 3ccf0fd4c2d024d696bdb1e71a0b36af38ad6bed

Requested commit: 3ccf0fd4c2d024d696bdb1e71a0b36af38ad6bed

Commit: 3ccf0fd4c2d024d696bdb1e71a0b36af38ad6bed

Tree: ab05699caca1a13fd5888e75a3296b2426aaf5b2

Author: David Rubin

Committer: David Rubin

## Message

```
riscv: basic struct field access

the current implementation only works when the struct is in a register. we use some shifting magic
to get the field into the LSB, and from there, given the type provenance, the generated code should
never reach into the bits beyond the bit size of the type and interact with the rest of the struct.

```

## Parents

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

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