a handy function CqsPrioGT_ to compare two priorities without having to build the...
authorGengbin Zheng <gzheng@illinois.edu>
Thu, 5 May 2011 07:33:14 +0000 (02:33 -0500)
committerGengbin Zheng <gzheng@illinois.edu>
Thu, 5 May 2011 07:33:14 +0000 (02:33 -0500)
src/conv-core/queueing.c
src/conv-core/queueing.h

index c8c14270aa318163e5816317457c26c08de66bda..24b0180e403010fa6d3c3686abc7cbf850a32435 100644 (file)
@@ -180,6 +180,22 @@ void CqsPrioqRehash(_prioq pq)
 }
 #endif
 
+int CqsPrioGT_(unsigned int ints1, unsigned int *data1, unsigned int ints2, unsigned int *data2)
+{
+  unsigned int val1;
+  unsigned int val2;
+  while (1) {
+    if (ints1==0) return 0;
+    if (ints2==0) return 1;
+    val1 = *data1++;
+    val2 = *data2++;
+    if (val1 < val2) return 0;
+    if (val1 > val2) return 1;
+    ints1--;
+    ints2--;
+  }
+}
+
 /**
  * Compare two priorities (treated as unsigned).
  * @return 1 if prio1 > prio2
index 0d13c89156632671008bdf26e26d298e0dc42284..025399f927b7a7cc540fc2173aa994253813c10e 100644 (file)
@@ -193,6 +193,7 @@ void CqsDequeue(Queue, void **msgPtr);
 
 unsigned int CqsLength(Queue);
 int CqsEmpty(Queue);
+int CqsPrioGT_(unsigned int ints1, unsigned int *data1, unsigned int ints2, unsigned int *data2);
 int CqsPrioGT(_prio, _prio);
 
 /** Get the priority of the highest priority message in q */