<commit_before>package debox

import annotation.tailrec
import scala.math.{min, max}
import scala.{specialized => spec}

object Util {
  def alloc[@spec A:Manifest](src:Array[A], s1:Int, len:Int) = {
    val as = Array.ofDim[A](len)
    copy(src, as, s1, 0, len)
    as
  }

  def copy[@spec A](src:Array[A], dst:Array[A], s1:Int, d1:Int, len:Int) {
    var i = s1
    var j = d1
    var k = s1 + len
    while (i < k) {
      dst(j) = src(i)
      i += 1
      j += 1
    }
  }

  def rcopy[@spec A](src:Array[A], dst:Array[A], s1:Int, d1:Int, len:Int) {
    var i = s1 + len - 1
    var j = d1 + len - 1
    while (i >= s1) {
      dst(j) = src(i)
      i -= 1
      j -= 1
    }
  }
}<commit_msg>prefer System.arraycopy()<commit_after>package debox

import annotation.tailrec
import scala.math.{min, max}
import scala.{specialized => spec}

object Util {
  def alloc[@spec A:Manifest](src:Array[A], s1:Int, len:Int) = {
    val as = Array.ofDim[A](len)
    copy(src, as, s1, 0, len)
    as
  }

  def copy[@spec A](src:Array[A], dst:Array[A], s1:Int, d1:Int, len:Int) {
    System.arraycopy(src, s1, dst, d1, len)
  }

  def rcopy[@spec A](src:Array[A], dst:Array[A], s1:Int, d1:Int, len:Int) {
    System.arraycopy(src, s1, dst, d1, len)
  }
}
{'fraction_non_alphanumeric': 0.17963111467522053, 'fraction_numerical': 0.024057738572574178, 'mean_word_length': 2.84, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1662856', 'n_tokens_mistral': 545, 'n_tokens_neox': 531, 'n_words': 129}