v0.3.1 patches (#53)

* mGBA output wasn't resetting its length used

* admonish people to stay updated

* IWRAM fix

* version bump

* fix to work with latest nightly.

* don't know what this is or why we have it

* Delete the builtins module

The `__clzsi2` function is now part of the compiler-builtins crate, so it's part of all of Rust.

* ??

* mgba 0.7 came out!
This commit is contained in:
Lokathor 2019-02-02 00:26:08 -07:00 committed by GitHub
parent e29453f8d8
commit edfffbb704
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 5 additions and 269 deletions

View file

@ -18,3 +18,5 @@ gba-proc-macro = "0.5"
[profile.release]
lto = true
panic = "abort"
incremental = false
codegen-units = 1

View file

@ -5,6 +5,3 @@ pub mod fixed_point;
pub mod volatile;
pub(crate) use self::volatile::*;
pub mod builtins;
//pub(crate) use self::builtins::*;

View file

@ -1,87 +0,0 @@
#![allow(missing_docs)]
//! The module to provide "builtin" functions that LLVM expects.
//!
//! You shouldn't need to call anything in here yourself, it just has to be in
//! the translation unit and LLVM will find it.
#[no_mangle]
#[cfg(any(target_pointer_width = "16", target_pointer_width = "32", target_pointer_width = "64"))]
pub extern "C" fn __clzsi2(mut x: usize) -> usize {
// TODO: const this? Requires const if
let mut y: usize;
let mut n: usize = {
#[cfg(target_pointer_width = "64")]
{
64
}
#[cfg(target_pointer_width = "32")]
{
32
}
#[cfg(target_pointer_width = "16")]
{
16
}
};
#[cfg(target_pointer_width = "64")]
{
y = x >> 32;
if y != 0 {
n -= 32;
x = y;
}
}
#[cfg(any(target_pointer_width = "32", target_pointer_width = "64"))]
{
y = x >> 16;
if y != 0 {
n -= 16;
x = y;
}
}
y = x >> 8;
if y != 0 {
n -= 8;
x = y;
}
y = x >> 4;
if y != 0 {
n -= 4;
x = y;
}
y = x >> 2;
if y != 0 {
n -= 2;
x = y;
}
y = x >> 1;
if y != 0 {
n - 2
} else {
n - x
}
}
#[test]
fn __clzsi2_test() {
let mut i: usize = core::usize::MAX;
while i > 0 {
assert_eq!(__clzsi2(i) as u32, i.leading_zeros());
i >>= 1;
}
// check 0 also
i = 0;
assert_eq!(__clzsi2(i) as u32, i.leading_zeros());
// double check for bit patterns that aren't solid 1s
i = 1;
for _ in 0 .. 63 {
assert_eq!(__clzsi2(i) as u32, i.leading_zeros());
i <<= 2;
i += 1;
}
}
// TODO: add some shims
// #[no_mangle] extern "aapcs" fn __aeabi_uidiv(num: u32: denom: u32) -> u32
// #[no_mangle] extern "aapcs" fn __aeabi_idiv(num: i32: denom: i32) -> u32

View file

@ -1,8 +1,8 @@
//! Special utils for if you're running on the mGBA emulator.
//!
//! Note that this assumes that you're using the very latest version (0.7-beta1
//! at the time of this writing). If you've got some older version of things
//! there might be any number of differences or problems.
//! Note that this assumes that you're using the very latest version (0.7). If
//! you've got some older version of things there might be any number of
//! differences or problems.
use super::*;

176
tags

File diff suppressed because one or more lines are too long