diff -rupN re2_orig/re2/compile.cc re2_new/re2/compile.cc
--- re2_orig/re2/compile.cc	2014-11-23 16:30:31.791329900 +0200
+++ re2_new/re2/compile.cc	2014-11-23 16:32:33.494444000 +0200
@@ -7,7 +7,10 @@
 // Prog and Inst are defined in prog.h.
 // This file's external interface is just Regexp::CompileToProg.
 // The Compiler class defined in this file is private.
-
+#ifdef WIN32
+#include <stdio.h>
+#define snprintf _snprintf
+#endif
 #include "re2/prog.h"
 #include "re2/re2.h"
 #include "re2/regexp.h"
@@ -503,7 +506,7 @@ int Compiler::RuneByteSuffix(uint8 lo, u
     return UncachedRuneByteSuffix(lo, hi, foldcase, next);
   }
 
-  uint64 key = ((uint64)next << 17) | (lo<<9) | (hi<<1) | foldcase;
+  uint64 key = ((uint64)next << 17) | (lo<<9) | (hi<<1) | (foldcase ? 1ULL : 0ULL);
   map<uint64, int>::iterator it = rune_cache_.find(key);
   if (it != rune_cache_.end())
     return it->second;
diff -rupN re2_orig/re2/prefilter_tree.cc re2_new/re2/prefilter_tree.cc
--- re2_orig/re2/prefilter_tree.cc	2014-11-23 16:30:31.931969800 +0200
+++ re2_new/re2/prefilter_tree.cc	2014-11-23 16:33:19.306972200 +0200
@@ -7,6 +7,10 @@
 #include "re2/prefilter.h"
 #include "re2/prefilter_tree.h"
 #include "re2/re2.h"
+#ifdef WIN32
+#include <stdio.h>
+#define snprintf _snprintf
+#endif
 
 DEFINE_int32(filtered_re2_min_atom_len,
              3,
diff -rupN re2_orig/re2/re2.cc re2_new/re2/re2.cc
--- re2_orig/re2/re2.cc	2014-11-23 16:30:31.931969800 +0200
+++ re2_new/re2/re2.cc	2014-11-23 16:40:08.197610400 +0200
@@ -11,7 +11,13 @@
 
 #include <stdio.h>
 #include <string>
-#include <pthread.h>
+#ifdef WIN32
+#define strtoll _strtoi64
+#define strtoull _strtoui64
+#define strtof strtod
+#else
+ #include <pthread.h>
+#endif
 #include <errno.h>
 #include "util/atomicops.h"
 #include "util/util.h"
@@ -34,7 +40,7 @@ const VariadicFunction2<bool, StringPiec
 
 // This will trigger LNK2005 error in MSVC.
 #ifndef COMPILER_MSVC
-const int RE2::Options::kDefaultMaxMem;  // initialized in re2.h
+//const int RE2::Options::kDefaultMaxMem;  // initialized in re2.h
 #endif  // COMPILER_MSVC
 
 RE2::Options::Options(RE2::CannedOptions opt)
diff -rupN re2_orig/re2/re2.h re2_new/re2/re2.h
--- re2_orig/re2/re2.h	2014-11-23 16:30:31.963219700 +0200
+++ re2_new/re2/re2.h	2014-11-23 16:41:58.400689600 +0200
@@ -5,6 +5,7 @@
 #ifndef RE2_RE2_H
 #define RE2_RE2_H
 
+#define kDefaultMaxMem (8<<20)
 // C++ interface to the re2 regular-expression library.
 // RE2 supports Perl-style regular expressions (with extensions like
 // \d, \w, \s, ...).
@@ -556,7 +557,6 @@ class RE2 {
     // If this happens too often, RE2 falls back on the NFA implementation.
 
     // For now, make the default budget something close to Code Search.
-    static const int kDefaultMaxMem = 8<<20;
 
     enum Encoding {
       EncodingUTF8 = 1,
diff -rupN re2_orig/re2/stringpiece.h re2_new/re2/stringpiece.h
--- re2_orig/re2/stringpiece.h	2014-11-23 16:30:32.103836100 +0200
+++ re2_new/re2/stringpiece.h	2014-11-23 16:42:42.760097000 +0200
@@ -23,6 +23,9 @@
 #include <cstddef>
 #include <iosfwd>
 #include <string>
+#ifdef WIN32
+#include <algorithm>
+#endif
 
 namespace re2 {
 
diff -rupN re2_orig/util/logging.h re2_new/util/logging.h
--- re2_orig/util/logging.h	2014-11-23 16:30:32.338202900 +0200
+++ re2_new/util/logging.h	2014-11-23 16:43:21.869608500 +0200
@@ -7,7 +7,11 @@
 #ifndef RE2_UTIL_LOGGING_H__
 #define RE2_UTIL_LOGGING_H__
 
-#include <unistd.h>  /* for write */
+#ifdef WIN32
+ #include <io.h>
+#else
+ #include <unistd.h>  /* for write */
+#endif
 #include <sstream>
 
 // Debug-only checking.
diff -rupN re2_orig/util/mutex.h re2_new/util/mutex.h
--- re2_orig/util/mutex.h	2014-11-23 16:30:32.338202900 +0200
+++ re2_new/util/mutex.h	2014-11-23 16:44:09.931924800 +0200
@@ -14,7 +14,10 @@
 
 namespace re2 {
 
-#define HAVE_PTHREAD 1
+#ifndef WIN32
+ #define HAVE_PTHREAD 1
+ #define HAVE_RWLOCK 1
+#endif
 #define HAVE_RWLOCK 1
 
 #if defined(NO_THREADS)
diff -rupN re2_orig/util/stringprintf.cc re2_new/util/stringprintf.cc
--- re2_orig/util/stringprintf.cc	2014-11-23 16:30:32.353822900 +0200
+++ re2_new/util/stringprintf.cc	2014-11-23 16:44:38.713225400 +0200
@@ -3,6 +3,9 @@
 // license that can be found in the LICENSE file.
 
 #include "util/util.h"
+#ifndef va_copy
+#define va_copy(d,s) ((d) = (s)) //KLUGE: for MS compilers
+#endif
 
 namespace re2 { 
 
diff -rupN re2_orig/util/util.h re2_new/util/util.h
--- re2_orig/util/util.h	2014-11-23 16:30:32.369447200 +0200
+++ re2_new/util/util.h	2014-11-23 17:01:07.186487000 +0200
@@ -12,7 +12,9 @@
 #include <stddef.h>         // For size_t
 #include <assert.h>
 #include <stdarg.h>
+#ifndef WIN32
 #include <sys/time.h>
+#endif
 #include <time.h>
 #include <ctype.h>	// For isdigit, isalpha.
 
diff -rupN re2_orig/util/valgrind.h re2_new/util/valgrind.h
--- re2_orig/util/valgrind.h	2014-11-23 16:30:32.369447200 +0200
+++ re2_new/util/valgrind.h	2014-11-23 16:48:08.322600200 +0200
@@ -125,7 +125,7 @@
 #  endif
 #endif
 
-
+#ifndef WIN32
 /* ------------------------------------------------------------------ */
 /* ARCHITECTURE SPECIFICS for SPECIAL INSTRUCTIONS.  There is nothing */
 /* in here of use to end-users -- skip to the next section.           */
@@ -4170,7 +4170,7 @@ typedef
                                VG_USERREQ__DISCARD_TRANSLATIONS,  \
                                _qzz_addr, _qzz_len, 0, 0, 0);     \
    }
-
+#endif
 
 /* These requests are for getting Valgrind itself to print something.
    Possibly with a backtrace.  This is a really ugly hack.  The return value
