What is this `@sp` syntax in this quick sort code for scala?

Viewed 311

I am trying to understand this quick sort code from the following repo

  object QuickSort {
    @inline final def limit: Int = 16

    final def sort[@sp A:Order:ClassTag](data:Array[A]): Unit = qsort(data, 0, data.length - 1)

    final def qsort[@sp A](data:Array[A], left: Int, right: Int)(implicit o:Order[A], ct:ClassTag[A]): Unit = {

      if (right - left < limit) return InsertionSort.sort(data, left, right + 1)

      val pivot = left + (right - left) / 2
      val next = partition(data, left, right, pivot)
      qsort(data, left, next - 1)
      qsort(data, next + 1, right)
    }

    final def partition[@sp A](data:Array[A], left:Int, right:Int, pivot:Int)(implicit o:Order[A], ct:ClassTag[A]): Int = {

      val value = data(pivot)

      //swap(pivot, right)
      var tmp = data(pivot); data(pivot) = data(right); data(right) = tmp

      var store = left
      var i = left
      while (i < right) {
        if (o.lt(data(i), value)) {
          //swap(i, store)
          tmp = data(i); data(i) = data(store); data(store) = tmp
          store += 1
        }
        i += 1
      }
      //swap(store, right)
      tmp = data(store); data(store) = data(right); data(right) = tmp
      store
    }
  }

What is the purpose of [@sp A] ? I know [A] syntax is for generics, but what does adding @sp do? Can someone shed some insight on this?

Thanks

1 Answers
Related