aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / vendor / serde_json / build.rs
| 1 | use std::env; |
| 2 | |
| 3 | fn main() { |
| 4 | println!("cargo:rerun-if-changed=build.rs"); |
| 5 | |
| 6 | println!("cargo:rustc-check-cfg=cfg(fast_arithmetic, values(\"32\", \"64\"))"); |
| 7 | |
| 8 | // Decide ideal limb width for arithmetic in the float parser and string |
| 9 | // parser. |
| 10 | let target_arch = env::var_os("CARGO_CFG_TARGET_ARCH").unwrap(); |
| 11 | let target_pointer_width = env::var_os("CARGO_CFG_TARGET_POINTER_WIDTH").unwrap(); |
| 12 | if target_arch == "aarch64" |
| 13 | || target_arch == "loongarch64" |
| 14 | || target_arch == "mips64" |
| 15 | || target_arch == "powerpc64" |
| 16 | || target_arch == "riscv64" |
| 17 | || target_arch == "wasm32" |
| 18 | || target_arch == "x86_64" |
| 19 | || target_pointer_width == "64" |
| 20 | { |
| 21 | // The above list of architectures are ones that have native support for |
| 22 | // 64-bit arithmetic, but which have some targets using a smaller |
| 23 | // pointer width. Examples include aarch64-unknown-linux-gnu_ilp32 and |
| 24 | // x86_64-unknown-linux-gnux32. So our choice of limb width is not |
| 25 | // equivalent to using usize everywhere. |
| 26 | println!("cargo:rustc-cfg=fast_arithmetic=\"64\""); |
| 27 | } else { |
| 28 | println!("cargo:rustc-cfg=fast_arithmetic=\"32\""); |
| 29 | } |
| 30 | } |