33
44#include < bit>
55#include < cstdint>
6- #include < stdbit.h>
6+ // #include <stdbit.h>
77
8- #if __STDC_VERSION_STDBIT_H__ < 202311L
9- #error need __STDC_ENDIAN_NATIVE__ compiler support
10- #endif
8+ // #if __STDC_VERSION_STDBIT_H__ < 202311L
9+ // #error need __STDC_ENDIAN_NATIVE__ compiler support
10+ // #endif
1111
12- #if __STDC_ENDIAN_NATIVE__ != __STDC_ENDIAN_LITTLE__ && __STDC_ENDIAN_NATIVE__ != __STDC_ENDIAN_BIG__
13- #error requires a regular little-endian or big-endian machine
14- #endif
12+ // #if __STDC_ENDIAN_NATIVE__ != __STDC_ENDIAN_LITTLE__ && __STDC_ENDIAN_NATIVE__ != __STDC_ENDIAN_BIG__
13+ // #error requires a regular little-endian or big-endian machine
14+ // #endif
1515
1616namespace Video
1717{
@@ -20,22 +20,24 @@ namespace Video
2020 */
2121struct alignas (uint32_t ) Pixel
2222{
23+ static_assert (std::endian::native == std::endian::little);
24+
2325 /* * \brief Type alias to allow for raw manipulation. */
2426 using ARGB32 = uint32_t ;
2527
2628 constexpr Pixel () : Pixel (0 ) {}
2729
28- #if __STDC_ENDIAN_NATIVE__ == __STDC_ENDIAN_LITTLE__
30+ // #if __STDC_ENDIAN_NATIVE__ == __STDC_ENDIAN_LITTLE__
2931 constexpr Pixel (ARGB32 argb) : b (argb), g (argb >> 8 ), r (argb >> 16 ), a (argb >> 24 ) {}
3032 constexpr Pixel (uint8_t A, uint8_t R, uint8_t G, uint8_t B) : b{B}, g{G}, r{R}, a{A} {}
3133
3234 uint8_t b, g, r, a;
33- #else
34- constexpr Pixel (ARGB32 argb) : a (argb >> 24 ), r (argb >> 16 ), g (argb >> 8 ), b (argb) {}
35- constexpr Pixel (uint8_t A, uint8_t R, uint8_t G, uint8_t B) : a{A}, r{R}, g{G}, b{B} {}
35+ // #else
36+ // constexpr Pixel(ARGB32 argb) : a(argb >> 24), r(argb >> 16), g(argb >> 8), b(argb) {}
37+ // constexpr Pixel(uint8_t A, uint8_t R, uint8_t G, uint8_t B) : a{A}, r{R}, g{G}, b{B} {}
3638
37- uint8_t a, r, g, b;
38- #endif // __STDC_ENDIAN_NATIVE__
39+ // uint8_t a, r, g, b;
40+ // #endif // __STDC_ENDIAN_NATIVE__
3941
4042 constexpr ARGB32 AsU32 () const noexcept { return static_cast <ARGB32>(*this ); }
4143
0 commit comments