System.Net.Topology.ByteArrayExtensions.Not C# (CSharp) Method

Not() static private method

static private Not ( this bits ) : byte[]
bits this
return byte[]
        internal static byte[] Not(this byte[] bits)
        {
            if (bits == null)
                throw new ArgumentNullException(nameof(bits));

            if (bits.Length == 4)
            {
                var i = BitConverter.ToInt32(bits, 0);
                return BitConverter.GetBytes(~i);
            }
            var newBytes = new byte[bits.Length];
            for (int i = 0; i < newBytes.Length; ++i)
                newBytes[i] = unchecked((byte)(~bits[i]));
            return newBytes;
        }