@@ -161,7 +161,7 @@ public static PrintStream nondetPrintStream()
161161
162162 /**
163163 * Return a non-deterministic BufferedInputStream.
164- * It is not recommended to use it, since it will not enforce that
164+ * It is not recommended to use it, since it will not enforce that
165165 * BufferedInputStream is loaded, but is necessary for initializing System.in.
166166 */
167167 public static BufferedInputStream nondetBufferedInputStream ()
@@ -222,7 +222,7 @@ public static int getCurrentThreadID()
222222 }
223223
224224 /**
225- * This method is used by jbmc to indicate an atomic section which enforces
225+ * This method is used by JBMC to indicate an atomic section which enforces
226226 * the bmc equation to avoid interleavings of the code inside the section
227227 */
228228 public static void atomicBegin ()
@@ -235,7 +235,7 @@ public static void atomicBegin()
235235 }
236236
237237 /**
238- * This method is used by jbmc to indicate the end of an atomic section
238+ * This method is used by JBMC to indicate the end of an atomic section
239239 * (see atomicBegin).
240240 */
241241 public static void atomicEnd ()
@@ -262,10 +262,48 @@ public static void notModelled()
262262 }
263263
264264 /**
265- * Retrieves the current locking count for 'object'.
266- */
267- public static int getMonitorCount (Object object )
268- {
269- return object .cproverMonitorCount ;
265+ * Array copy for byte arrays. Does not check for exceptions.
266+ * Use instead of System.arraycopy when the bounds are ensured to be
267+ * respected, that is, the following should be false:
268+ * srcPos < 0 || destPos < 0 || length < 0 ||
269+ * srcPos + length > src.length || destPos + length > dest.length
270+ *
271+ * @param src the source array.
272+ * @param srcPos starting position in the source array.
273+ * @param dest the destination array.
274+ * @param destPos starting position in the destination data.
275+ * @param length the number of array elements to be copied.
276+ */
277+ public static void arraycopy (byte [] src , int srcPos , byte [] dest ,
278+ int destPos , int length ) {
279+ byte [] temp = new byte [length ];
280+ for (int i = 0 ; i < length ; i ++) {
281+ temp [i ] = src [srcPos + i ];
282+ }
283+ for (int i = 0 ; i < length ; i ++) {
284+ dest [destPos + i ] = temp [i ];
285+ }
286+ }
287+
288+ /**
289+ * Array copy for byte arrays. Does not check for exceptions,
290+ * and assumes that `src` and `dest`.
291+ * Use instead of System.arraycopy when `src` and `dest` are guaranteed to be
292+ * different and the bounds are ensured to be
293+ * respected, that is, the following should be false:
294+ * src == dest || srcPos < 0 || destPos < 0 || length < 0 ||
295+ * srcPos + length > src.length || destPos + length > dest.length
296+ *
297+ * @param src the source array.
298+ * @param srcPos starting position in the source array.
299+ * @param dest the destination array.
300+ * @param destPos starting position in the destination data.
301+ * @param length the number of array elements to be copied.
302+ */
303+ public static void arraycopyInPlace (byte [] src , int srcPos , byte [] dest ,
304+ int destPos , int length ) {
305+ for (int i = 0 ; i < length ; i ++) {
306+ dest [destPos + i ] = src [srcPos + i ];
307+ }
270308 }
271309}
0 commit comments