lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject [lucy-commits] [46/54] [abbrv] git commit: refs/heads/sortex_ptr_only - Change type for some SortEx private functions.
Date Sat, 26 Apr 2014 23:12:16 GMT
Change type for some SortEx private functions.

Modify some private subroutines in SortExternal to use Obj pointers
rather than byte addresses.


Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/7392ca1c
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/7392ca1c
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/7392ca1c

Branch: refs/heads/sortex_ptr_only
Commit: 7392ca1c8e700df22be4a7ea1bdeecdd9139fb21
Parents: 90cfcac
Author: Marvin Humphrey <marvin@rectangular.com>
Authored: Tue Jan 8 16:45:18 2013 -0800
Committer: Marvin Humphrey <marvin@rectangular.com>
Committed: Sat Apr 26 12:05:49 2014 -0700

----------------------------------------------------------------------
 core/Lucy/Util/SortExternal.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/7392ca1c/core/Lucy/Util/SortExternal.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/SortExternal.c b/core/Lucy/Util/SortExternal.c
index 4d68664..3aa3334 100644
--- a/core/Lucy/Util/SortExternal.c
+++ b/core/Lucy/Util/SortExternal.c
@@ -27,18 +27,18 @@ S_refill_cache(SortExternal *self, SortExternalIVARS *ivars);
 // cache.
 static void
 S_absorb_slices(SortExternal *self, SortExternalIVARS *ivars,
-                uint8_t *endpost);
+                Obj **endpost);
 
 // Return the address for the item in one of the runs' caches which is the
 // highest in sort order, but which we can guarantee is lower in sort order
 // than any item which has yet to enter a run cache.
-static uint8_t*
+static Obj**
 S_find_endpost(SortExternal *self, SortExternalIVARS *ivars);
 
-// Determine how many cache items are less than or equal to [endpost].
+// Determine how many buffered items are less than or equal to `endpost`.
 static uint32_t
 S_find_slice_size(SortExternal *self, SortExternalIVARS *ivars,
-                  uint8_t *endpost);
+                  Obj **endpost);
 
 SortExternal*
 SortEx_init(SortExternal *self) {
@@ -182,14 +182,14 @@ S_refill_cache(SortExternal *self, SortExternalIVARS *ivars) {
 
     // Absorb as many elems as possible from all runs into main cache.
     if (VA_Get_Size(ivars->runs)) {
-        uint8_t *endpost = S_find_endpost(self, ivars);
+        Obj **endpost = S_find_endpost(self, ivars);
         S_absorb_slices(self, ivars, endpost);
     }
 }
 
-static uint8_t*
+static Obj**
 S_find_endpost(SortExternal *self, SortExternalIVARS *ivars) {
-    uint8_t *endpost = NULL;
+    Obj **endpost = NULL;
 
     for (uint32_t i = 0, max = VA_Get_Size(ivars->runs); i < max; i++) {
         // Get a run and retrieve the last item in its cache.
@@ -203,7 +203,7 @@ S_find_endpost(SortExternal *self, SortExternalIVARS *ivars) {
         else {
             // Cache item with the highest sort value currently held in memory
             // by the run.
-            uint8_t *candidate = run_ivars->cache + tick * sizeof(Obj*);
+            Obj **candidate = (Obj**)run_ivars->cache + tick;
 
             // If it's the first run, item is automatically the new endpost.
             if (i == 0) {
@@ -221,7 +221,7 @@ S_find_endpost(SortExternal *self, SortExternalIVARS *ivars) {
 
 static void
 S_absorb_slices(SortExternal *self, SortExternalIVARS *ivars,
-                uint8_t *endpost) {
+                Obj **endpost) {
     uint32_t    num_runs     = VA_Get_Size(ivars->runs);
     Obj       **slice_starts = ivars->slice_starts;
     uint32_t   *slice_sizes  = ivars->slice_sizes;
@@ -314,17 +314,17 @@ SortEx_Grow_Cache_IMP(SortExternal *self, uint32_t size) {
 
 static uint32_t
 S_find_slice_size(SortExternal *self, SortExternalIVARS *ivars,
-                  uint8_t *endpost) {
+                  Obj **endpost) {
     int32_t          lo      = ivars->cache_tick - 1;
     int32_t          hi      = ivars->cache_max;
-    uint8_t *const   cache   = ivars->cache;
+    Obj            **cache   = (Obj**)ivars->cache;
     SortEx_Compare_t compare
         = METHOD_PTR(SortEx_Get_VTable(self), LUCY_SortEx_Compare);
 
     // Binary search.
     while (hi - lo > 1) {
         const int32_t mid   = lo + ((hi - lo) / 2);
-        const int32_t delta = compare(self, cache + mid * sizeof(Obj*), endpost);
+        const int32_t delta = compare(self, cache + mid, endpost);
         if (delta > 0) { hi = mid; }
         else           { lo = mid; }
     }


Mime
View raw message