mirror of
https://github.com/drewcassidy/quicktex.git
synced 2024-09-13 06:37:34 +00:00
use member initialization for constexpr constructors
This commit is contained in:
parent
b3d6585799
commit
8967bc2f1a
@ -47,13 +47,11 @@ class alignas(8) BC1Block {
|
|||||||
std::array<uint8_t, SelectorSize> _selectors;
|
std::array<uint8_t, SelectorSize> _selectors;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// Create a new BC1Block
|
/// Create a new BC1Blok
|
||||||
constexpr BC1Block() {
|
constexpr BC1Block() : _color0(), _color1(), _selectors() {
|
||||||
static_assert(sizeof(BC1Block) == 8);
|
static_assert(sizeof(BC1Block) == 8);
|
||||||
static_assert(sizeof(std::array<BC1Block, 10>) == 8 * 10);
|
static_assert(sizeof(std::array<BC1Block, 10>) == 8 * 10);
|
||||||
static_assert(alignof(BC1Block) >= 8);
|
static_assert(alignof(BC1Block) >= 8);
|
||||||
_color0 = _color1 = {0, 0};
|
|
||||||
_selectors = {0, 0, 0, 0};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -36,12 +36,10 @@ class alignas(8) BC3Block {
|
|||||||
BC4Block alpha_block;
|
BC4Block alpha_block;
|
||||||
BC1Block color_block;
|
BC1Block color_block;
|
||||||
|
|
||||||
constexpr BC3Block() {
|
constexpr BC3Block() : alpha_block(BC4Block()), color_block(BC1Block()) {
|
||||||
static_assert(sizeof(BC3Block) == 16);
|
static_assert(sizeof(BC3Block) == 16);
|
||||||
static_assert(sizeof(std::array<BC3Block, 10>) == 16 * 10);
|
static_assert(sizeof(std::array<BC3Block, 10>) == 16 * 10);
|
||||||
static_assert(alignof(BC3Block) >= 8);
|
static_assert(alignof(BC3Block) >= 8);
|
||||||
alpha_block = BC4Block();
|
|
||||||
color_block = BC1Block();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BC3Block(const BC4Block &alpha, const BC1Block &color) {
|
BC3Block(const BC4Block &alpha, const BC1Block &color) {
|
||||||
@ -56,7 +54,7 @@ class alignas(8) BC3Block {
|
|||||||
color_block = blocks.second;
|
color_block = blocks.second;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const BC3Block& other) const = default;
|
bool operator==(const BC3Block &other) const = default;
|
||||||
bool operator!=(const BC3Block& other) const = default;
|
bool operator!=(const BC3Block &other) const = default;
|
||||||
};
|
};
|
||||||
} // namespace quicktex::s3tc
|
} // namespace quicktex::s3tc
|
@ -48,12 +48,10 @@ class alignas(8) BC4Block {
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
/// Create a new BC4Block
|
/// Create a new BC4Block
|
||||||
constexpr BC4Block() {
|
constexpr BC4Block() : alpha0(0), alpha1(0), _selectors() {
|
||||||
static_assert(sizeof(BC4Block) == 8);
|
static_assert(sizeof(BC4Block) == 8);
|
||||||
static_assert(sizeof(std::array<BC4Block, 10>) == 8 * 10);
|
static_assert(sizeof(std::array<BC4Block, 10>) == 8 * 10);
|
||||||
static_assert(alignof(BC4Block) >= 8);
|
static_assert(alignof(BC4Block) >= 8);
|
||||||
alpha0 = alpha1 = 0;
|
|
||||||
_selectors = {0, 0, 0, 0, 0, 0};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,11 +35,10 @@ class alignas(8) BC5Block {
|
|||||||
BC4Block chan0_block;
|
BC4Block chan0_block;
|
||||||
BC4Block chan1_block;
|
BC4Block chan1_block;
|
||||||
|
|
||||||
constexpr BC5Block() {
|
constexpr BC5Block() : chan0_block(BC4Block()), chan1_block(BC4Block()) {
|
||||||
static_assert(sizeof(BC5Block) == 16);
|
static_assert(sizeof(BC5Block) == 16);
|
||||||
static_assert(sizeof(std::array<BC5Block, 10>) == 16 * 10);
|
static_assert(sizeof(std::array<BC5Block, 10>) == 16 * 10);
|
||||||
static_assert(alignof(BC5Block) >= 8);
|
static_assert(alignof(BC5Block) >= 8);
|
||||||
chan0_block = chan1_block = BC4Block();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BC5Block(const BC4Block &chan0, const BC4Block &chan1) {
|
BC5Block(const BC4Block &chan0, const BC4Block &chan1) {
|
||||||
@ -54,7 +53,7 @@ class alignas(8) BC5Block {
|
|||||||
chan1_block = pair.second;
|
chan1_block = pair.second;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const BC5Block& other) const = default;
|
bool operator==(const BC5Block &other) const = default;
|
||||||
bool operator!=(const BC5Block& other) const = default;
|
bool operator!=(const BC5Block &other) const = default;
|
||||||
};
|
};
|
||||||
} // namespace quicktex::s3tc
|
} // namespace quicktex::s3tc
|
Loading…
Reference in New Issue
Block a user