@@ -263,6 +263,7 @@ object DynamicTuple {
263
263
264
264
def dynamicConcat [This <: Tuple , That <: Tuple ](self : This , that : That ): Concat [This , That ] = {
265
265
type Result = Concat [This , That ]
266
+
266
267
(self : Any ) match {
267
268
case self : Unit => return that.asInstanceOf [Result ]
268
269
case _ =>
@@ -275,20 +276,15 @@ object DynamicTuple {
275
276
276
277
val arr = new Array [Object ](self.size + that.size)
277
278
278
- (self : Any ) match {
279
- case xxl : TupleXXL =>
280
- System .arraycopy(xxl.elems, 0 , arr, 0 , self.size)
281
- case _ =>
282
- itToArray(self.asInstanceOf [Product ].productIterator, self.size, arr, 0 )
283
- }
284
-
285
- (that : Any ) match {
279
+ inline def copyToArray [T <: Tuple ](tuple : T , array : Array [Object ], offset : Int ): Unit = (tuple : Any ) match {
286
280
case xxl : TupleXXL =>
287
- System .arraycopy(xxl.elems, 0 , arr, self.size, that .size)
281
+ System .arraycopy(xxl.elems, 0 , array, offset, tuple .size)
288
282
case _ =>
289
- itToArray(that .asInstanceOf [Product ].productIterator, that .size, arr, self.size )
283
+ itToArray(tuple .asInstanceOf [Product ].productIterator, tuple .size, array, offset )
290
284
}
291
285
286
+ copyToArray(self, arr, 0 )
287
+ copyToArray(that, arr, self.size)
292
288
dynamicFromIArray[Result ](arr.asInstanceOf [IArray [Object ]])
293
289
}
294
290
0 commit comments