]> git.gag.com Git - fw/sdcc/blobdiff - src/SDCCset.c
PIC16 - Applied patch from Vangelis Rokas. Many fixes for the PIC16 port.
[fw/sdcc] / src / SDCCset.c
index 5014303f18d63a0b6c2e615d5a6975b137d21fcc..f8bab7367feb245dd287cc5a7bee4c9d16680e7c 100644 (file)
@@ -402,6 +402,22 @@ elementsInSet (set * s)
   return count;
 }
 
+/*-----------------------------------------------------------------*/
+/* indexSet - returns the i'th item in set                         */
+/*-----------------------------------------------------------------*/
+void *indexSet(set * s, int index)
+{
+  set *loop=s;
+  
+  while(loop && index) {
+       index--;
+       loop = loop->next;
+  }
+
+  return (loop->item);
+}
+
+
 /*-----------------------------------------------------------------*/
 /* reverseSet - reverse the order of the items of a set            */
 /*-----------------------------------------------------------------*/