/// <summary> /// Computes the one's complement sum on a byte array combination. /// </summary> /// <param name="byteArraySegment">The byte array segment.</param> /// <param name="prefixedBytes">The prefixed bytes.</param> /// <returns><see cref="Int32" />.</returns> public static Int32 OnesComplementSum(ByteArraySegment byteArraySegment, byte[] prefixedBytes) { // Just complement the one's sum. return(~OnesSum(byteArraySegment, prefixedBytes)); }
/// <summary> /// Computes the one's complement sum on a byte array combination. /// </summary> /// <param name="byteArraySegment">The byte array segment.</param> /// <param name="prefixedBytes">The prefixed bytes.</param> /// <param name="padOddBytesToLeft">if set to <c>true</c> pads the last byte to the left if it has an odd index.</param> /// <returns><see cref="Int32" />.</returns> public static Int32 OnesComplementSum(ByteArraySegment byteArraySegment, byte[] prefixedBytes, bool padOddBytesToLeft = true) { //just complement the one's sum return(~OnesSum(byteArraySegment, prefixedBytes, padOddBytesToLeft) & 0xFFFF); }