]> git.lizzy.rs Git - rust.git/blobdiff - example/mini_core.rs
Fix rotate_left and rotate_right with 128bit shift amount
[rust.git] / example / mini_core.rs
index 10cba992056292c515319787ae13bcd05e673401..c4834c804087199822e4552a19874744235992ef 100644 (file)
@@ -365,6 +365,22 @@ fn ne(&self, other: &Self) -> bool {
     }
 }
 
+#[lang = "shl"]
+pub trait Shl<RHS = Self> {
+    type Output;
+
+    #[must_use]
+    fn shl(self, rhs: RHS) -> Self::Output;
+}
+
+impl Shl for u128 {
+    type Output = u128;
+
+    fn shl(self, rhs: u128) -> u128 {
+        self << rhs
+    }
+}
+
 #[lang = "neg"]
 pub trait Neg {
     type Output;
@@ -532,8 +548,8 @@ pub mod intrinsics {
 }
 
 pub mod libc {
-    #[cfg_attr(not(windows), link(name = "c"))]
-    #[cfg_attr(windows, link(name = "msvcrt"))]
+    #[cfg_attr(unix, link(name = "c"))]
+    #[cfg_attr(target_env = "msvc", link(name = "msvcrt"))]
     extern "C" {
         pub fn puts(s: *const i8) -> i32;
         pub fn printf(format: *const i8, ...) -> i32;
@@ -605,6 +621,7 @@ struct PanicLocation {
 }
 
 #[no_mangle]
+#[cfg(not(windows))]
 pub fn get_tls() -> u8 {
     #[thread_local]
     static A: u8 = 42;