]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libphobos/libdruntime/core/internal/util/array.d
d: Import dmd b8384668f, druntime e6caaab9, phobos 5ab9ad256 (v2.098.0-beta.1)
[thirdparty/gcc.git] / libphobos / libdruntime / core / internal / util / array.d
similarity index 60%
rename from libphobos/libdruntime/rt/util/array.d
rename to libphobos/libdruntime/core/internal/util/array.d
index b2cfb8ddd087f4e01865f7c2f6cae896636def5c..bc9b72c1474d2408eabd93a0c9843b5370dfece4 100644 (file)
@@ -1,12 +1,12 @@
 /**
-Array utilities.
-
-Copyright: Denis Shelomovskij 2013
-License: $(HTTP boost.org/LICENSE_1_0.txt, Boost License 1.0).
-Authors: Denis Shelomovskij
-Source: $(DRUNTIMESRC src/rt/util/_array.d)
-*/
-module rt.util.array;
+ * Array utilities.
+ *
+ * Copyright: Denis Shelomovskij 2013
+ * License: $(HTTP boost.org/LICENSE_1_0.txt, Boost License 1.0).
+ * Authors: Denis Shelomovskij
+ * Source: $(DRUNTIMESRC core/internal/util/_array.d)
+ */
+module core.internal.util.array;
 
 
 import core.internal.string;
@@ -16,15 +16,15 @@ import core.stdc.stdint;
 @safe /* pure dmd @@@BUG11461@@@ */ nothrow:
 
 void enforceTypedArraysConformable(T)(const char[] action,
-    const T[] a1, const T[] a2, in bool allowOverlap = false)
+    const T[] a1, const T[] a2, const bool allowOverlap = false)
 {
     _enforceSameLength(action, a1.length, a2.length);
     if (!allowOverlap)
         _enforceNoOverlap(action, arrayToPtr(a1), arrayToPtr(a2), T.sizeof * a1.length);
 }
 
-void enforceRawArraysConformable(const char[] action, in size_t elementSize,
-    const void[] a1, const void[] a2, in bool allowOverlap = false)
+void enforceRawArraysConformable(const char[] action, const size_t elementSize,
+    const void[] a1, const void[] a2, const bool allowOverlap = false)
 {
     _enforceSameLength(action, a1.length, a2.length);
     if (!allowOverlap)
@@ -32,7 +32,7 @@ void enforceRawArraysConformable(const char[] action, in size_t elementSize,
 }
 
 private void _enforceSameLength(const char[] action,
-    in size_t length1, in size_t length2)
+    const size_t length1, const size_t length2)
 {
     if (length1 == length2)
         return;
@@ -41,14 +41,14 @@ private void _enforceSameLength(const char[] action,
     string msg = "Array lengths don't match for ";
     msg ~= action;
     msg ~= ": ";
-    msg ~= length1.unsignedToTempString(tmpBuff, 10);
+    msg ~= length1.unsignedToTempString(tmpBuff);
     msg ~= " != ";
-    msg ~= length2.unsignedToTempString(tmpBuff, 10);
-    throw new Error(msg);
+    msg ~= length2.unsignedToTempString(tmpBuff);
+    assert(0, msg);
 }
 
 private void _enforceNoOverlap(const char[] action,
-    uintptr_t ptr1, uintptr_t ptr2, in size_t bytes)
+    uintptr_t ptr1, uintptr_t ptr2, const size_t bytes)
 {
     const d = ptr1 > ptr2 ? ptr1 - ptr2 : ptr2 - ptr1;
     if (d >= bytes)
@@ -59,10 +59,10 @@ private void _enforceNoOverlap(const char[] action,
     string msg = "Overlapping arrays in ";
     msg ~= action;
     msg ~= ": ";
-    msg ~= overlappedBytes.unsignedToTempString(tmpBuff, 10);
+    msg ~= overlappedBytes.unsignedToTempString(tmpBuff);
     msg ~= " byte(s) overlap of ";
-    msg ~= bytes.unsignedToTempString(tmpBuff, 10);
-    throw new Error(msg);
+    msg ~= bytes.unsignedToTempString(tmpBuff);
+    assert(0, msg);
 }
 
 private uintptr_t arrayToPtr(const void[] array) @trusted