Don't fail to compile on unsupported architectures
This commit is contained in:
parent
c978b408e2
commit
34d1bf415e
|
@ -1,13 +1,27 @@
|
||||||
macro_rules! arch_specific {
|
macro_rules! arch_specific {
|
||||||
{
|
{
|
||||||
$({$($cfg:tt)*} : $mod:ident;)*
|
$({$($cfg:tt)*} : $mod:ident;)*
|
||||||
} => {$(
|
} => {
|
||||||
|
$(
|
||||||
#[cfg($($cfg)*)]
|
#[cfg($($cfg)*)]
|
||||||
mod $mod;
|
mod $mod;
|
||||||
|
|
||||||
#[cfg($($cfg)*)]
|
#[cfg($($cfg)*)]
|
||||||
pub use $mod::*;
|
pub use $mod::*;
|
||||||
)*};
|
|
||||||
|
#[cfg($($cfg)*)]
|
||||||
|
pub const FL_ARCH_SPECIFIC_SUPPORTED: bool = true;
|
||||||
|
)*
|
||||||
|
|
||||||
|
#[cfg(not(any($($($cfg)*),*)))]
|
||||||
|
mod unsupported;
|
||||||
|
|
||||||
|
#[cfg(not(any($($($cfg)*),*)))]
|
||||||
|
pub use unsupported::*;
|
||||||
|
|
||||||
|
#[cfg(not(any($($($cfg)*),*)))]
|
||||||
|
pub const FL_ARCH_SPECIFIC_SUPPORTED: bool = false;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
arch_specific! {
|
arch_specific! {
|
||||||
|
|
16
hbvm/src/float/unsupported.rs
Normal file
16
hbvm/src/float/unsupported.rs
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
use hbbytecode::RoundingMode;
|
||||||
|
|
||||||
|
#[inline(always)]
|
||||||
|
pub fn conv64to32(_: f64, _: RoundingMode) -> f32 {
|
||||||
|
f32::NAN
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline(always)]
|
||||||
|
pub fn f32toint(_: f32, _: RoundingMode) -> i64 {
|
||||||
|
i64::MAX
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline(always)]
|
||||||
|
pub fn f64toint(_: f64, _: RoundingMode) -> i64 {
|
||||||
|
i64::MAX
|
||||||
|
}
|
|
@ -25,6 +25,8 @@ mod float;
|
||||||
mod utils;
|
mod utils;
|
||||||
mod vmrun;
|
mod vmrun;
|
||||||
|
|
||||||
|
pub use float::FL_ARCH_SPECIFIC_SUPPORTED;
|
||||||
|
|
||||||
use {
|
use {
|
||||||
bmc::BlockCopier,
|
bmc::BlockCopier,
|
||||||
mem::{Address, Memory},
|
mem::{Address, Memory},
|
||||||
|
|
|
@ -14,6 +14,17 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
eprintln!("== HB×RT (Holey Bytes Experimental Runtime) v0.1 ==");
|
eprintln!("== HB×RT (Holey Bytes Experimental Runtime) v0.1 ==");
|
||||||
eprintln!("[W] Currently supporting only flat images");
|
eprintln!("[W] Currently supporting only flat images");
|
||||||
|
|
||||||
|
if !hbvm::FL_ARCH_SPECIFIC_SUPPORTED {
|
||||||
|
eprintln!(
|
||||||
|
"\
|
||||||
|
[W] Architecture not fully supported!\n \
|
||||||
|
FTI32, FTI64 will yield {:#x}\n \
|
||||||
|
FC64T32 will yield NaN\
|
||||||
|
",
|
||||||
|
i64::MAX,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
let mut args = args().skip(1);
|
let mut args = args().skip(1);
|
||||||
let Some(image_path) = args.next() else {
|
let Some(image_path) = args.next() else {
|
||||||
eprintln!("[E] Missing image path");
|
eprintln!("[E] Missing image path");
|
||||||
|
|
Loading…
Reference in a new issue