pspp-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pspp-cvs] Changes to pspp/src/algorithm.c


From: Ben Pfaff
Subject: [Pspp-cvs] Changes to pspp/src/algorithm.c
Date: Tue, 15 Mar 2005 01:04:12 -0500

Index: pspp/src/algorithm.c
diff -u pspp/src/algorithm.c:1.12 pspp/src/algorithm.c:1.13
--- pspp/src/algorithm.c:1.12   Tue Nov 16 08:08:00 2004
+++ pspp/src/algorithm.c        Tue Mar 15 06:04:10 2005
@@ -365,6 +365,34 @@
   return nonzero_cnt;
 }
 
+/* Removes N elements starting at IDX from ARRAY, which consists
+   of COUNT elements of SIZE bytes each, by shifting the elements
+   following them, if any, into its position. */
+void
+remove_range (void *array_, size_t count, size_t size,
+              size_t idx, size_t n) 
+{
+  char *array = array_;
+  
+  assert (array != NULL);
+  assert (idx <= count);
+  assert (idx + n <= count);
+
+  if (idx + n < count)
+    memmove (array + idx * size, array + (idx + n) * size,
+             size * (count - idx - n));
+}
+
+/* Removes element IDX from ARRAY, which consists of COUNT
+   elements of SIZE bytes each, by shifting the elements
+   following it, if any, into its position. */
+void
+remove_element (void *array, size_t count, size_t size,
+                size_t idx) 
+{
+  remove_range (array, count, size, idx, 1);
+}
+
 /* A predicate and its auxiliary data. */
 struct pred_aux 
   {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]