From 77c423b9aad5e5ae7e19a999585e6646444d7b61 Mon Sep 17 00:00:00 2001
From: Nikolaj Bjorner <nbjorner@microsoft.com>
Date: Tue, 29 Sep 2015 14:14:29 -0700
Subject: [PATCH] annotate enode hash as signed character to address issue #210

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
---
 src/parsers/smt2/smt2scanner.cpp |  4 ++--
 src/parsers/smt2/smt2scanner.h   |  2 +-
 src/smt/smt_enode.cpp            |  2 +-
 src/smt/smt_enode.h              | 12 ++++++------
 4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/parsers/smt2/smt2scanner.cpp b/src/parsers/smt2/smt2scanner.cpp
index 729475f..18d40d4 100644
--- a/src/parsers/smt2/smt2scanner.cpp
+++ b/src/parsers/smt2/smt2scanner.cpp
@@ -92,7 +92,7 @@ namespace smt2 {
     scanner::token scanner::read_symbol_core() {
         while (true) {
             char c = curr();
-            char n = m_normalized[static_cast<unsigned char>(c)];
+            signed char n = m_normalized[static_cast<unsigned char>(c)];
             if (n == 'a' || n == '0' || n == '-') {
                 m_string.push_back(c);
                 next();
@@ -257,7 +257,7 @@ namespace smt2 {
         m_smtlib2_compliant = ctx.params().m_smtlib2_compliant;
 
         for (int i = 0; i < 256; ++i) {
-            m_normalized[i] = (char) i;
+            m_normalized[i] = (signed char) i;
         }
         m_normalized[static_cast<int>('\t')] = ' ';
         m_normalized[static_cast<int>('\r')] = ' ';
diff --git a/src/parsers/smt2/smt2scanner.h b/src/parsers/smt2/smt2scanner.h
index 60726ca..8313c24 100644
--- a/src/parsers/smt2/smt2scanner.h
+++ b/src/parsers/smt2/smt2scanner.h
@@ -42,7 +42,7 @@ namespace smt2 {
         rational           m_number;
         unsigned           m_bv_size;
         // end of data
-        char               m_normalized[256];
+        signed char        m_normalized[256];
 #define SCANNER_BUFFER_SIZE 1024
         char               m_buffer[SCANNER_BUFFER_SIZE];
         unsigned           m_bpos;
diff --git a/src/smt/smt_enode.cpp b/src/smt/smt_enode.cpp
index 4515773..679c467 100644
--- a/src/smt/smt_enode.cpp
+++ b/src/smt/smt_enode.cpp
@@ -216,7 +216,7 @@ namespace smt {
         // m_lbl_hash should be different from -1, if and only if,
         // there is a pattern that contains the enode. So,
         // I use a trail to restore the value of m_lbl_hash to -1.
-        ctx.push_trail(value_trail<context, char>(m_lbl_hash));
+        ctx.push_trail(value_trail<context, signed char>(m_lbl_hash));
         unsigned h = hash_u(get_owner_id());
         m_lbl_hash = h & (APPROX_SET_CAPACITY - 1);
         // propagate modification to the root m_lbls set.
diff --git a/src/smt/smt_enode.h b/src/smt/smt_enode.h
index 3e174a7..7c32248 100644
--- a/src/smt/smt_enode.h
+++ b/src/smt/smt_enode.h
@@ -52,11 +52,11 @@ namespace smt {
 #else
     class app2enode_t : public u_map<enode *> {
     public:
-      void setx(unsigned x, enode *val, enode *def){
-	if(val == 0)
-	  erase(x);
-	else
-	  insert(x,val);
+        void setx(unsigned x, enode *val, enode *def){
+            if (val == 0)
+                erase(x);
+            else
+                insert(x,val);
       }
     };
 #endif
@@ -105,7 +105,7 @@ namespace smt {
         enode_vector        m_parents;          //!< Parent enodes of the equivalence class.
         theory_var_list     m_th_var_list;      //!< List of theories that 'care' about this enode.
         trans_justification m_trans;            //!< A justification for the enode being equal to its root.
-        char                m_lbl_hash;         //!< It is different from -1, if enode is used in a pattern
+        signed char         m_lbl_hash;         //!< It is different from -1, if enode is used in a pattern
         approx_set          m_lbls;
         approx_set          m_plbls;
         enode *             m_args[0];          //!< Cached args
