@@ -263,6 +263,7 @@ object DynamicTuple {
263263
264264 def dynamicConcat [This <: Tuple , That <: Tuple ](self : This , that : That ): Concat [This , That ] = {
265265 type Result = Concat [This , That ]
266+
266267 (self : Any ) match {
267268 case self : Unit => return that.asInstanceOf [Result ]
268269 case _ =>
@@ -275,20 +276,15 @@ object DynamicTuple {
275276
276277 val arr = new Array [Object ](self.size + that.size)
277278
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 {
286280 case xxl : TupleXXL =>
287- System .arraycopy(xxl.elems, 0 , arr, self.size, that .size)
281+ System .arraycopy(xxl.elems, 0 , array, offset, tuple .size)
288282 case _ =>
289- itToArray(that .asInstanceOf [Product ].productIterator, that .size, arr, self.size )
283+ itToArray(tuple .asInstanceOf [Product ].productIterator, tuple .size, array, offset )
290284 }
291285
286+ copyToArray(self, arr, 0 )
287+ copyToArray(that, arr, self.size)
292288 dynamicFromIArray[Result ](arr.asInstanceOf [IArray [Object ]])
293289 }
294290
0 commit comments