pez-globo / pufferfish-software

All software for the Pufferfish ventilator.
Apache License 2.0
0 stars 1 forks source link

`get_byte` and `set_byte` should fail to compile for incorrect byte indices #379

Closed ethanjli closed 3 years ago

ethanjli commented 3 years ago

Currently Util::get_byte<...> and Util::set_byte<...> seem to "wrap around" when byte_index is out of bounds. When byte_index is out of bounds, the function should instead fail a static assertion comparing it to sizeof(T).

See also https://github.com/pez-globo/pufferfish-software/pull/366#discussion_r649634497 and https://github.com/pez-globo/pufferfish-software/pull/366#discussion_r649635495