tuned;
authorwenzelm
Fri, 05 Jul 2024 13:36:49 +0200
changeset 80511 11ca26978dd4
parent 80510 bbeb2f2049aa
child 80512 6a58d706cfb2
tuned;
src/Pure/General/bytes.scala
--- a/src/Pure/General/bytes.scala	Fri Jul 05 13:04:39 2024 +0200
+++ b/src/Pure/General/bytes.scala	Fri Jul 05 13:36:49 2024 +0200
@@ -29,9 +29,6 @@
   private val block_size: Int = 16384  // see java.io.InputStream.DEFAULT_BUFFER_SIZE
   private val chunk_size: Long = Space.MiB(100).bytes
 
-  private def make_size(chunks: Array[Array[Byte]], buffer: Array[Byte]): Long =
-    chunks.foldLeft(buffer.length.toLong)((n, chunk) => n + chunk.length)
-
   class Too_Large(size: Long, limit: Long) extends IndexOutOfBoundsException {
     override def getMessage: String =
       "Bytes too large for particular operation: " +
@@ -302,7 +299,9 @@
     offset != 0L || {
       chunks match {
         case None => size != chunk0.length
-        case Some(cs) => size != Bytes.make_size(cs, chunk0)
+        case Some(cs) =>
+          val physical_size = cs.foldLeft(chunk0.length.toLong)((n, c) => n + c.length)
+          size != physical_size
       }
     }