Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

big-endian support #4

Closed
alkis opened this issue Dec 13, 2015 · 4 comments
Closed

big-endian support #4

alkis opened this issue Dec 13, 2015 · 4 comments

Comments

@alkis
Copy link
Owner

alkis commented Dec 13, 2015

Currently libdecNumber.a is compiled with little-endian support. build.rs needs to detect big or little endian target architecture and pass DECLITEND=0 (for little) or DECLITEND=1 (for big).

@trolleyman
Copy link
Contributor

Is this what you were thinking?

// build.rs
extern crate gcc;

fn main() {
    let endianness = if cfg!(endian = "little") {
        "0"
    } else {
        "1"
    };
    gcc::Config::new()
        .include("decNumber")
        .file("decNumber/decContext.c")
        .file("decNumber/decDouble.c")
        .file("decNumber/decNumber.c")
        .file("decNumber/decPacked.c")
        .file("decNumber/decQuad.c")
        .file("decNumber/decSingle.c")
        .file("decNumber/decimal128.c")
        .file("decNumber/decimal32.c")
        .file("decNumber/decimal64.c")
        .define("DECNUMDIGITS", Some("34"))
        .define("DECLITEND", Some(endianness))
        .compile("libdecNumber.a");
}

@alkis
Copy link
Owner Author

alkis commented Dec 15, 2015

Is the endian feature something rust exports by default?

@trolleyman
Copy link
Contributor

Yeah, it's here in the reference and here in the docs.

@alkis
Copy link
Owner Author

alkis commented Dec 15, 2015

Oh awesome! Thanks for the pointer :-)

@alkis alkis closed this as completed in #8 Dec 15, 2015
alkis added a commit that referenced this issue Dec 15, 2015
Add correct endianess support.

Fixes #4.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants