mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
src: fix warnings in aliased_buffer
* Unary minus usages on unsigned type * Implicit casts to/from input parameters PR-URL: https://github.com/nodejs/node/pull/19665 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Khaidi Chu <i@2333.moe> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
This commit is contained in:
@@ -126,13 +126,11 @@ class AliasedBuffer {
|
||||
index_(that.index_) {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline Reference& operator=(const T& val) {
|
||||
inline Reference& operator=(const NativeT& val) {
|
||||
aliased_buffer_->SetValue(index_, val);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// This is not caught by the template operator= above.
|
||||
inline Reference& operator=(const Reference& val) {
|
||||
return *this = static_cast<NativeT>(val);
|
||||
}
|
||||
@@ -141,9 +139,8 @@ class AliasedBuffer {
|
||||
return aliased_buffer_->GetValue(index_);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline Reference& operator+=(const T& val) {
|
||||
const T current = aliased_buffer_->GetValue(index_);
|
||||
inline Reference& operator+=(const NativeT& val) {
|
||||
const NativeT current = aliased_buffer_->GetValue(index_);
|
||||
aliased_buffer_->SetValue(index_, current + val);
|
||||
return *this;
|
||||
}
|
||||
@@ -152,9 +149,10 @@ class AliasedBuffer {
|
||||
return this->operator+=(static_cast<NativeT>(val));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline Reference& operator-=(const T& val) {
|
||||
return this->operator+=(-val);
|
||||
inline Reference& operator-=(const NativeT& val) {
|
||||
const NativeT current = aliased_buffer_->GetValue(index_);
|
||||
aliased_buffer_->SetValue(index_, current - val);
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user