예제 #1
0
    public static unsafe void Xor(byte *stream, byte *source, byte *destination, int length)
    {
        if (Avx.IsSupported && Avx2.IsSupported)
        {
            while (length >= 32)
            {
                Vector256 <byte> v0 = Avx.LoadVector256(stream);
                Vector256 <byte> v1 = Avx.LoadVector256(source);
                Avx.Store(destination, Avx2.Xor(v0, v1));

                stream      += 32;
                source      += 32;
                destination += 32;
                length      -= 32;
            }
        }

        if (Sse2.IsSupported)
        {
            while (length >= 16)
            {
                Vector128 <byte> v0 = Sse2.LoadVector128(stream);
                Vector128 <byte> v1 = Sse2.LoadVector128(source);
                Sse2.Store(destination, Sse2.Xor(v0, v1));

                stream      += 16;
                source      += 16;
                destination += 16;
                length      -= 16;
            }
        }

        FastUtils.Xor(stream, source, destination, length);
    }
예제 #2
0
 protected override unsafe void Xor(byte *stream, byte *source, byte *destination, int length)
 {
     FastUtils.Xor(stream, source, destination, length);
 }