Skip to content

Commit e859747

Browse files
committed
i128 shift intrinsics
1 parent 409d5ea commit e859747

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,8 @@ features = ["c"]
193193

194194
These builtins are needed to support 128-bit integers, which are in the process of being added to Rust.
195195

196-
- [ ] ashlti3.c
197-
- [ ] ashrti3.c
196+
- [x] ashlti3.c
197+
- [x] ashrti3.c
198198
- [ ] divti3.c
199199
- [ ] fixdfti.c
200200
- [ ] fixsfti.c
@@ -204,7 +204,7 @@ These builtins are needed to support 128-bit integers, which are in the process
204204
- [ ] floattisf.c
205205
- [ ] floatuntidf.c
206206
- [ ] floatuntisf.c
207-
- [ ] lshrti3.c
207+
- [x] lshrti3.c
208208
- [ ] modti3.c
209209
- [x] muloti4.c
210210
- [x] multi3.c

build.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,6 @@ fn main() {
178178
sources.extend(&["absvti2.c",
179179
"addtf3.c",
180180
"addvti3.c",
181-
"ashlti3.c",
182-
"ashrti3.c",
183181
"clzti2.c",
184182
"cmpti2.c",
185183
"ctzti2.c",
@@ -198,7 +196,6 @@ fn main() {
198196
"floatuntidf.c",
199197
"floatuntisf.c",
200198
"floatuntixf.c",
201-
"lshrti3.c",
202199
"modti3.c",
203200
"multf3.c",
204201
"mulvti3.c",

src/int/shift.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#[cfg(not(all(feature = "c", target_arch = "x86")))]
21
use int::{Int, LargeInt};
32

43
macro_rules! ashl {
@@ -58,12 +57,18 @@ macro_rules! lshr {
5857
#[cfg(not(all(feature = "c", target_arch = "x86")))]
5958
ashl!(__ashldi3: u64);
6059

60+
ashl!(__ashlti3: ::U128_);
61+
6162
#[cfg(not(all(feature = "c", target_arch = "x86")))]
6263
ashr!(__ashrdi3: i64);
6364

65+
ashr!(__ashrti3: ::I128_);
66+
6467
#[cfg(not(all(feature = "c", target_arch = "x86")))]
6568
lshr!(__lshrdi3: u64);
6669

70+
lshr!(__lshrti3: ::U128_);
71+
6772
#[cfg(test)]
6873
mod tests {
6974
use qc::{I64, U64};

src/lib.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,17 @@ macro_rules! srem {
8989
}
9090
}
9191

92+
// C API is expected to tolerate some amount of size mismatch in ABI. Hopefully the amount of
93+
// handling is sufficient for bootstrapping.
94+
#[cfg(stage0)]
95+
type U128_ = u64;
96+
#[cfg(stage0)]
97+
type I128_ = i64;
98+
#[cfg(not(stage0))]
99+
type U128_ = u128;
100+
#[cfg(not(stage0))]
101+
type I128_ = i128;
102+
92103
#[cfg(test)]
93104
#[macro_use]
94105
extern crate quickcheck;

0 commit comments

Comments
 (0)