[geos-commits] [SCM] GEOS branch master updated. 6d7d21530f466ab36d62912ac5f2a2cdb5070700

git at osgeo.org git at osgeo.org
Thu Oct 10 12:46:52 PDT 2019


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GEOS".

The branch, master has been updated
       via  6d7d21530f466ab36d62912ac5f2a2cdb5070700 (commit)
       via  398b0bd019e305ec76cd2730a6a1f11be8d54269 (commit)
       via  695340f0ebccae7175622af107c8be7e638f8819 (commit)
       via  b624ffb5b4a5327effe83470fd245a9bb14a9dfe (commit)
       via  ecfeb6fa494f8fa5da9ad53d2e1a1da8551fd3de (commit)
      from  8bc0ff9dc0a1036989238d1e01d1fa4c9f5df3c4 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 6d7d21530f466ab36d62912ac5f2a2cdb5070700
Merge: 8bc0ff9 398b0bd
Author: Daniel Baston <dbaston at gmail.com>
Date:   Thu Oct 10 15:46:41 2019 -0400

    Merge remote-tracking branch 'nilason/doublebits-tostring-implement'


commit 398b0bd019e305ec76cd2730a6a1f11be8d54269
Author: nila <n_larsson at yahoo.com>
Date:   Fri Oct 4 12:08:44 2019 +0200

    Update JTS port info

diff --git a/include/geos/index/quadtree/DoubleBits.h b/include/geos/index/quadtree/DoubleBits.h
index 4fa3351..9a00d90 100644
--- a/include/geos/index/quadtree/DoubleBits.h
+++ b/include/geos/index/quadtree/DoubleBits.h
@@ -12,7 +12,7 @@
  *
  **********************************************************************
  *
- * Last port: index/quadtree/DoubleBits.java rev. 1.7 (JTS-1.10)
+ * Last port: index/quadtree/DoubleBits.java rev. 1.7 (JTS-1.16)
  *
  **********************************************************************/
 
diff --git a/src/index/quadtree/DoubleBits.cpp b/src/index/quadtree/DoubleBits.cpp
index c64b24e..336d411 100644
--- a/src/index/quadtree/DoubleBits.cpp
+++ b/src/index/quadtree/DoubleBits.cpp
@@ -13,7 +13,7 @@
  *
  **********************************************************************
  *
- * Last port: index/quadtree/DoubleBits.java rev. 1.7 (JTS-1.10)
+ * Last port: index/quadtree/DoubleBits.java rev. 1.7 (JTS-1.16)
  *
  **********************************************************************/
 

commit 695340f0ebccae7175622af107c8be7e638f8819
Author: nila <n_larsson at yahoo.com>
Date:   Fri Oct 4 11:59:13 2019 +0200

    Remove commented-out variable
    
    following https://github.com/locationtech/jts/commit/f503345e5be88ab457076ecc96307a6dd18ad86c

diff --git a/src/index/quadtree/DoubleBits.cpp b/src/index/quadtree/DoubleBits.cpp
index 2ab1abc..c64b24e 100644
--- a/src/index/quadtree/DoubleBits.cpp
+++ b/src/index/quadtree/DoubleBits.cpp
@@ -157,7 +157,6 @@ int
 DoubleBits::numCommonMantissaBits(const DoubleBits& db) const
 {
     for(int i = 0; i < 52; i++) {
-        //int bitIndex=i+12;
         if(getBit(i) != db.getBit(i)) {
             return i;
         }

commit b624ffb5b4a5327effe83470fd245a9bb14a9dfe
Author: nila <n_larsson at yahoo.com>
Date:   Fri Oct 4 11:42:44 2019 +0200

    Add toString test

diff --git a/tests/unit/index/quadtree/DoubleBitsTest.cpp b/tests/unit/index/quadtree/DoubleBitsTest.cpp
index 338c69e..f33a128 100644
--- a/tests/unit/index/quadtree/DoubleBitsTest.cpp
+++ b/tests/unit/index/quadtree/DoubleBitsTest.cpp
@@ -31,6 +31,19 @@ void object::test<1>
     ensure_equals(DoubleBits::exponent(128.0), 7);
 }
 
+// 2 - Test toString()
+template<>
+template<>
+void object::test<2>
+()
+{
+    ensure_equals(DoubleBits(-1).toString(),
+        "1  01111111111(0) 0000000000000000000000000000000000000000000000000000 [ -1.000000 ]");
+    ensure_equals(DoubleBits(8.0).toString(),
+        "0  10000000010(3) 0000000000000000000000000000000000000000000000000000 [ 8.000000 ]");
+    ensure_equals(DoubleBits(128.0).toString(),
+        "0  10000000110(7) 0000000000000000000000000000000000000000000000000000 [ 128.000000 ]");
+}
 
 } // namespace tut
 

commit ecfeb6fa494f8fa5da9ad53d2e1a1da8551fd3de
Author: nila <n_larsson at yahoo.com>
Date:   Fri Oct 4 11:42:17 2019 +0200

    Add implementation

diff --git a/src/index/quadtree/DoubleBits.cpp b/src/index/quadtree/DoubleBits.cpp
index ec036de..2ab1abc 100644
--- a/src/index/quadtree/DoubleBits.cpp
+++ b/src/index/quadtree/DoubleBits.cpp
@@ -22,6 +22,7 @@
 
 #include <string>
 #include <cstring>
+#include <bitset>
 
 #if __STDC_IEC_559__
 #define ASSUME_IEEE_DOUBLE 1
@@ -168,20 +169,16 @@ DoubleBits::numCommonMantissaBits(const DoubleBits& db) const
 string
 DoubleBits::toString() const
 {
-    // TODO: Fix it!
-
-    return "FIXME: unimplemented DoubleBits::toString()";
-
-    //String numStr = Long.toBinaryString(xBits);
-    //// 64 zeroes!
-    //String zero64 = "0000000000000000000000000000000000000000000000000000000000000000";
-    //String padStr =  zero64 + numStr;
-    //String bitStr = padStr.substring(padStr.length() - 64);
-    //String str = bitStr.substring(0, 1) + "  "
-    //+ bitStr.substring(1, 12) + "(" + getExponent() + ") "
-    //+ bitStr.substring(12)
-    //+ " [ " + x + " ]";
-    //return str;
+    int64 bit;
+    memcpy(&bit, &x, sizeof(x));
+    string bitStr = bitset<64>(bit).to_string();
+
+    string str = bitStr.substr(0, 1) + "  "
+        + bitStr.substr(1, 11) + "(" + std::to_string(getExponent()) + ") "
+        + bitStr.substr(12)
+        + " [ " + std::to_string(x) + " ]";
+
+    return str;
 }
 
 } // namespace geos.index.quadtree

-----------------------------------------------------------------------

Summary of changes:
 include/geos/index/quadtree/DoubleBits.h     |  2 +-
 src/index/quadtree/DoubleBits.cpp            | 28 ++++++++++++----------------
 tests/unit/index/quadtree/DoubleBitsTest.cpp | 13 +++++++++++++
 3 files changed, 26 insertions(+), 17 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list