コード例 #1
0
    SortingResult PerformRadixSort(float[] input)
    {
        Stopwatch stopWatch = new Stopwatch();

        stopWatch.Start();

        if (sort == null)
        {
            sort = new RadixSort();
            sort.SetupBuffers(input.Length, radixSortShader);
        }


        sort.Sort(input);
        sort.GetData(input);

        stopWatch.Stop();

        bool isSorted = RadixDemoUtilities.SortingCheck(input);


        return(new SortingResult()
        {
            sortingName = "Radix Sort",
            averageTimeTaken = stopWatch.ElapsedMilliseconds,
            isCorrectlySorted = isSorted,
            message = isSorted ? "" : "Wrongly sorted at: " + input.Length
        });
    }