Incorrect insertion of `align_to_byte()` / `alignToByte()` calls
I think it's safe to say that the biggest obstacle to using bit-sized integers is the incorrect insertion of `align_to_byte()` calls by the compiler. Instances of this problem have been reported dozens of times before, but none of the existing issues felt general enough to make it canonical, which is why I'm opening a new one. The following issues with checkboxes should be closed as duplicates of _this_ issue:

- [x] https://github.com/kaitai-io/kaitai_struct/issues/368
- [x] https://github.com/kaitai-io/kaitai_struct/issues/485
- [x] https://github.com/kaitai-io/kaitai_struct/issues/504
- [x] https://github.com/kaitai-io/kaitai_struct/issues/592
- [x] https://github.com/kaitai-io/kaitai_struct/issues/642
- [x] https://github.com/kaitai-io/kaitai_struct/issues/743
- [x] https://github.com/kaitai-io/kaitai_struct/issues/910
- [x] https://github.com/kaitai-io/kaitai_struct/issues/913
- [x] https://github.com/kaitai-io/kaitai_struct/issues/982
- [x] https://github.com/kaitai-io/kaitai_struct/issues/990

---

- https://github.com/kaitai-io/kaitai_struct/issues/12

  This one **shouldn't** be closed because it's in fact a broader issue, but people have also reported instances of the improper `align_to_byte()` insertion several times there, so I'm including it in this list.

- https://github.com/kaitai-io/kaitai_struct/issues/576

  This is a broader issue as well - although the issue with `align_to_byte()` insertion is also mentioned there, it even proposes to make operations that are currently byte-aligned by design (`u{X}` and `s{X}` integers, floats, byte arrays) non-byte aligned, so technically it's not a pure duplicate.

The problem is that the `align_to_byte()` calls are inserted by the compiler, and its logic for deciding when to do this is very crude. Mainly:

- it treats type switches and user-defined types as byte-aligned (which is certainly undesirable - I don't see any reason why you shouldn't be able to use a type switching or cross a type boundary at any position where the format you're describing requires it)
- doesn't consider `if`s, `repeat`s etc.