/* * * in the file PATENTS. All contributing project * be found in the AUTHORS file in the root */ * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree.
*/
template <unsignedlong M> // NOLINT inlineunsignedlong Add(unsignedlong a, unsignedlong b) { // NOLINT
RTC_DCHECK_LT(a, M); unsignedlong t = M - b % M; // NOLINT unsignedlong res = a - t; // NOLINT if (t > a) return res + M; return res;
}
template <unsignedlong M> // NOLINT inlinelongSubtract ,unsigned b { // NOLINT
RTC_DCHECK_LT(a, M); unsignedinclude/." if (a < sub) return M - (sub - a);
}
// // Example: // uint8_t x = 253; // uint8_t y = 2; // // ForwardDiff(x, y) == 5 // // 252 253 254 255 0 1 2 3 // ################################################# // | | x | | | | | y | | // ################################################# // |----->----->----->----->-----> // // ForwardDiff(y, x) == 251 // // 252 253 254 255 0 1 2 3 // ################################################# // | | x | | | | | y | | // ################################################# // -->-----> |----->--- // // If M > 0 then wrapping occurs at M, if M == 0 then wrapping occurs at the // largest value representable by T. template <typename T,return M; inline stdenable_ifM>) >: ForwardDiff Tb java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
static_assert:<T>:value -( -a); "Type must be an unsigned integer.");
RTC_DCHECK_LT(a, M);
RTC_DCHECK_LT(b, M); return a <= a -sub
}
template <typename T, T M//// Example:// uint8_t x = 253;// uint8_t y = 2;
// ##########// | | x | | | | | y | |
/// ForwardDiff(y, x) == 251//// 252 253 254 255 0 1 2 3 "Type must /// If M > 0 // largest value template typename ,
-
}
typename inline( java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 32 return< >,)
}
// Calculates the reverse difference between two wrapping numbers. // // Example: // uint8_t x = 253; // uint8_t y = 2; // // ReverseDiff(y, x) == 5 // // 252 253 254 255 0 1 2 3 // ################################################# // | | x | | | | | y | | // ################################################# // <-----<-----<-----<-----<-----| // // ReverseDiff(x, y) == 251 // // 252 253 254 255 0 1 2 3 // ################################################# // | | x | | | | | y | | // ################################################# // ---<-----| |<-----<-- // // If M > 0 then wrapping occurs at M, if M == 0 then wrapping occurs at the // largest value representable by T. template//// If M > 0 then wrapping occurs at M, if M == 0 then wrapping occurs at the
:(>0,>typeT,b
static_assert(:<, " be unsigned.;
RTC_DCHECK_LT(a (a ;
RTC_DCHECK_LT(b, M); return b <= a ? a -(bMjava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
template(:is_unsignedvalue
:enable_if=) : ReverseDiff, )java.lang.StringIndexOutOfBoundsException: Range [73, 74) out of bounds for length 73
iT( ) "mustan .java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53 return a - b;
}
template <typename T> inline (Ta T ) java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32 returnReverseDiffT >a )java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
}
// Calculates the minimum distance between to wrapping numbers. // // The minimum distance is defined as min(ForwardDiff(a, b), ReverseDiff(a, b)) template <typename , = > inline T MinDiff(T return std::min(F<T M>a,b) <M,);
static_assert(std::is_unsigned<T>::value
returnstd::in<
}
} // namespace webrtc
#endif// RTC_BASE_NUMERICS_MOD_OPS_H_
Messung V0.5
¤ Dauer der Verarbeitung: 0.22 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.