lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nwelln...@apache.org
Subject [2/2] git commit: refs/heads/0.3 - Optimize decoding of similarity values
Date Sun, 19 Oct 2014 16:28:25 GMT
Optimize decoding of similarity values

Decoding of similarity values can be optimized in a similar way.


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

Branch: refs/heads/0.3
Commit: 07df6940ed49672f4c71b10321fb3617ac9ccfa0
Parents: 3bbf12d
Author: Nick Wellnhofer <wellnhofer@aevum.de>
Authored: Sun Oct 19 18:03:50 2014 +0200
Committer: Nick Wellnhofer <wellnhofer@aevum.de>
Committed: Sun Oct 19 18:25:25 2014 +0200

----------------------------------------------------------------------
 core/Lucy/Index/Similarity.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/07df6940/core/Lucy/Index/Similarity.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Similarity.c b/core/Lucy/Index/Similarity.c
index 27794ed..c6a18d4 100644
--- a/core/Lucy/Index/Similarity.c
+++ b/core/Lucy/Index/Similarity.c
@@ -194,9 +194,7 @@ Sim_decode_norm(Similarity *self, uint32_t input) {
         result = 0;
     }
     else {
-        const uint32_t mantissa = byte & 7;
-        const uint32_t exponent = (byte >> 3) & 31;
-        result = ((exponent + (63 - 15)) << 24) | (mantissa << 21);
+        result = (input + EXP_OFFSET) << 21;
     }
 
     return *(float*)&result;


Mime
View raw message