From a50189e8d1ae7e890511fbdbae046dc04e1229e9 Mon Sep 17 00:00:00 2001 From: trav90 Date: Wed, 19 Sep 2018 18:59:49 -0500 Subject: 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. --- js/src/vm/ArrayBufferObject.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'js') diff --git a/js/src/vm/ArrayBufferObject.h b/js/src/vm/ArrayBufferObject.h index 6614f5220..e9c9bc0e0 100644 --- a/js/src/vm/ArrayBufferObject.h +++ b/js/src/vm/ArrayBufferObject.h @@ -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; -- cgit v1.2.3