using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace PrequentialAucVerifier
{
    public class DoubleArrayComparer : IEqualityComparer<double[]>
    {
        [DllImport("msvcrt.dll", CallingConvention = CallingConvention.Cdecl)]
        static extern int memcmp(double[] b1, double[] b2, long count);

        public bool Equals(double[] x, double[] y)
        {
            //for (int i = 0; i < x.Length; i++)
            //{
            //    if (x[i] != y[i])
            //    {
            //        return false;
            //    }
            //}

            //return true;

            return memcmp(x, y, 6) == 0;
        }

        public int GetHashCode(double[] obj)
        {
            return (int)((((((obj[0] * 23) + obj[1]) * 23 + obj[2]) * 23 + obj[3]) * 23 + obj[4]) * 23 + obj[5]) * 23;
        }
    }
}
