Skip to content

Commit 3656091

Browse files
committed
Add specialized versions of tasty.Util.dble for common array element types
1 parent 4965cb4 commit 3656091

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tasty/src/dotty/tools/tasty/util/Util.scala

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,17 @@ object Util {
1111
arr1
1212
}
1313

14+
/** Specialized version for bytes */
15+
def dble(arr: Array[Byte]): Array[Byte] = {
16+
val arr1 = new Array[Byte](arr.length * 2)
17+
System.arraycopy(arr, 0, arr1, 0, arr.length)
18+
arr1
19+
}
20+
21+
/** Specialized version for ints */
22+
def dble(arr: Array[Int]): Array[Int] = {
23+
val arr1 = new Array[Int](arr.length * 2)
24+
System.arraycopy(arr, 0, arr1, 0, arr.length)
25+
arr1
26+
}
1427
}

0 commit comments

Comments
 (0)