Method PostDecExceptZero
- Namespace
- Zyl.VectorTraits.Impl.Util
- Assembly
- VectorTraits.dll
PostDecExceptZero<T>(ref T, out T, T)
When not equal to the zero, post-decrement of the given managed pointer (当不与0相等时, 向给定的托管指针后置递减).
Mnemonic: beforeValue = (*p != 0) ? *p-- : newValue).
public static ref T PostDecExceptZero<T>(ref T source, out T beforeValue, T newValue = default) where T : struct, IEquatable<T>
Parameters
sourceTThe managed pointer to decrement to (要向其递减的托管指针).
beforeValueTWhen not equal to the zero, returns the value pointed to before the decrement. Otherwise, it returns
newValue(当不与0相等时, 返回递减前所指向的值. 否则便返回newValue).newValueTWhen equal to the zero,
beforeValuereturns the new value (当与0相等时,beforeValue会返回这个新值).
Returns
- T
When not equal to the zero, post-decrement of the given managed pointer. Otherwise, it returns to the
source(当不与0相等时, 向给定的托管指针后置递减. 否则便返回source).
Type Parameters
TThe elemental type of the managed pointer (托管指针的元素类型).
- See Also