Skip to content

Commit

Permalink
const -> constexpr in Struct
Browse files Browse the repository at this point in the history
  • Loading branch information
KangarooKoala committed Nov 23, 2023
1 parent 61b7f6f commit 9937b34
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions wpiutil/src/main/native/include/wpi/struct/Struct.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ inline T UnpackStruct(std::span<const uint8_t> data) {
*/
template <StructSerializable T, size_t Offset, size_t N>
inline wpi::array<T, N> UnpackStructArray(std::span<const uint8_t> data) {
const auto StructSize = Struct<std::remove_cvref_t<T>>::kSize;
constexpr auto StructSize = Struct<std::remove_cvref_t<T>>::kSize;
wpi::array<T, N> arr(wpi::empty_array);
[&]<size_t... Is>(std::index_sequence<Is...>) {
((arr[Is] = UnpackStruct<T, Offset + Is * StructSize>(data)), ...);
Expand Down Expand Up @@ -197,7 +197,7 @@ inline void PackStruct(std::span<uint8_t> data, T&& value) {
template <size_t Offset, size_t N, StructSerializable T>
inline void PackStructArray(std::span<uint8_t> data,
const wpi::array<T, N>& arr) {
const auto StructSize = Struct<std::remove_cvref_t<T>>::kSize;
constexpr auto StructSize = Struct<std::remove_cvref_t<T>>::kSize;
[&]<size_t... Is>(std::index_sequence<Is...>) {
(PackStruct<Offset + Is * StructSize>(data, arr[Is]), ...);
}(std::make_index_sequence<N>{});
Expand Down

0 comments on commit 9937b34

Please sign in to comment.