about summary refs log tree commit diff
path: root/src/libcore/unicode.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-05-18 00:34:24 -0700
committerbors <bors@rust-lang.org>2013-05-18 00:34:24 -0700
commite91daaa8a9390ccf760b3ba7f965b2863103d993 (patch)
tree20d6c2af3206bfa8347c175624aea75d47aa078a /src/libcore/unicode.rs
parentac74bbec9327ef393041feb544d2468131e1759e (diff)
parentad6ee5f4e5f779d987ac7a35ce6f149039a45b15 (diff)
downloadrust-e91daaa8a9390ccf760b3ba7f965b2863103d993.tar.gz
rust-e91daaa8a9390ccf760b3ba7f965b2863103d993.zip
auto merge of #6586 : bjz/rust/formatting-and-conditionals, r=thestinger
Diffstat (limited to 'src/libcore/unicode.rs')
-rw-r--r--src/libcore/unicode.rs28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/libcore/unicode.rs b/src/libcore/unicode.rs
index d6e2c5eee6a..3b7fdcc85be 100644
--- a/src/libcore/unicode.rs
+++ b/src/libcore/unicode.rs
@@ -14,6 +14,7 @@
 
 pub mod general_category {
 
+    #[cfg(stage0)]
     fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool {
         use cmp::{Equal, Less, Greater};
         use vec::bsearch;
@@ -25,6 +26,18 @@ pub mod general_category {
         }) != None
     }
 
+    #[cfg(not(stage0))]
+    fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool {
+        use cmp::{Equal, Less, Greater};
+        use vec::bsearch;
+        use option::None;
+        (do bsearch(r) |&(lo,hi)| { cond!(
+            (lo <= c && c <= hi) { Equal   }
+            (hi < c)             { Less    }
+            _                    { Greater }
+        )}) != None
+    }
+
 
     static Cc_table : &'static [(char,char)] = &[
         ('\x00', '\x1f'), ('\x7f', '\x9f')
@@ -1449,8 +1462,7 @@ pub mod general_category {
 }
 
 pub mod derived_property {
-
-
+    #[cfg(stage0)]
     fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool {
         use cmp::{Equal, Less, Greater};
         use vec::bsearch;
@@ -1462,6 +1474,18 @@ pub mod derived_property {
         }) != None
     }
 
+    #[cfg(not(stage0))]
+    fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool {
+        use cmp::{Equal, Less, Greater};
+        use vec::bsearch;
+        use option::None;
+        (do bsearch(r) |&(lo,hi)| { cond!(
+            (lo <= c && c <= hi) { Equal   }
+            (hi < c)             { Less    }
+            _                    { Greater }
+        )}) != None
+    }
+
 
     static Alphabetic_table : &'static [(char,char)] = &[
         ('\x41', '\x5a'), ('\x61', '\x7a'),