mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-15 08:53:07 +09:00
Give uint8_clamped a defaulted (and also trivial) default constructor, copy constructor, and copy-assignment operator.
This also allows uint8_clamped to be permissibly memmove'd and memcpy'd.
This commit is contained in:
parent
23665c9250
commit
3bfbbf5d40
1 changed files with 3 additions and 6 deletions
|
|
@ -457,8 +457,8 @@ ClampDoubleToUint8(const double x);
|
|||
struct uint8_clamped {
|
||||
uint8_t val;
|
||||
|
||||
uint8_clamped() { }
|
||||
uint8_clamped(const uint8_clamped& other) : val(other.val) { }
|
||||
uint8_clamped() = default;
|
||||
uint8_clamped(const uint8_clamped& other) = default;
|
||||
|
||||
// invoke our assignment helpers for constructor conversion
|
||||
explicit uint8_clamped(uint8_t x) { *this = x; }
|
||||
|
|
@ -469,10 +469,7 @@ struct uint8_clamped {
|
|||
explicit uint8_clamped(int32_t x) { *this = x; }
|
||||
explicit uint8_clamped(double x) { *this = x; }
|
||||
|
||||
uint8_clamped& operator=(const uint8_clamped& x) {
|
||||
val = x.val;
|
||||
return *this;
|
||||
}
|
||||
uint8_clamped& operator=(const uint8_clamped& x) = default;
|
||||
|
||||
uint8_clamped& operator=(uint8_t x) {
|
||||
val = x;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue