You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2009/03/12 04:32:03 UTC

svn commit: r752759 - in /lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe: Integers.charm Integers.harm

Author: marvin
Date: Thu Mar 12 03:32:02 2009
New Revision: 752759

URL: http://svn.apache.org/viewvc?rev=752759&view=rev
Log:
Add PTR2I64 macro.

Modified:
    lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Integers.charm
    lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Integers.harm

Modified: lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Integers.charm
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Integers.charm?rev=752759&r1=752758&r2=752759&view=diff
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Integers.charm (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Integers.charm Thu Mar 12 03:32:02 2009
@@ -311,6 +311,18 @@
         append_conf("#define CHY_U64_C(n) n##%s\n", u64_t_postfix);
     }
 
+    /* Create macro for promoting pointers to integers. */
+    if (has_64) {
+        if (sizeof_ptr == 8) {
+            append_conf("#define CHY_PTR2I64(ptr) "
+                "((chy_i64_t)(chy_u64_t)(ptr))\n");
+        }
+        else {
+            append_conf("#define CHY_PTR2I64(ptr) "
+                "((chy_i64_t)(chy_u32_t)(ptr))\n");
+        }
+    }
+
     /* true and false */
     append_conf(
         "#ifndef true\n"
@@ -382,6 +394,7 @@
         shorten_macro("U64P");
         shorten_macro("I64_C");
         shorten_macro("U64_C");
+        shorten_macro("PTR2I64");
     } 
     END_SHORT_NAMES;
     

Modified: lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Integers.harm
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Integers.harm?rev=752759&r1=752758&r2=752759&view=diff
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Integers.harm (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Integers.harm Thu Mar 12 03:32:02 2009
@@ -67,9 +67,14 @@
  * I32_MIN
  * I64_MIN
  *
- * If 64-bit integers type are available, these macros will expand to the
- * printf conversion specification for signed and unsigned versions (most
- * commonly "lld" and "llu").
+ * If 64-bit integers are available, this macro will promote pointers to i64_t
+ * safely.
+ * 
+ * PTR2I64(ptr)
+ *
+ * If 64-bit integers are available, these macros will expand to the printf
+ * conversion specification for signed and unsigned versions (most commonly
+ * "lld" and "llu").
  *
  * I64P
  * U64P