1
0
mirror of https://github.com/bitdefender/bddisasm.git synced 2024-12-22 14:08:08 +00:00

* Added missing Rust source file.

This commit is contained in:
Andrei Vlad LUTAS 2024-11-07 12:07:59 +02:00
parent ed18dfc562
commit bcc637baf7
2 changed files with 49 additions and 2 deletions

View File

@ -22,7 +22,7 @@
//! //!
//! ```toml //! ```toml
//! [dependencies] //! [dependencies]
//! bddisasm = "0.5.0" //! bddisasm = "0.5.1"
//! ``` //! ```
//! //!
//! # Examples //! # Examples
@ -205,6 +205,7 @@ pub mod isa_set;
pub mod mnemonic; pub mod mnemonic;
pub mod operand; pub mod operand;
pub mod rflags; pub mod rflags;
pub mod simd_exceptions;
pub mod tuple; pub mod tuple;
pub use crate::decode_error::DecodeError; pub use crate::decode_error::DecodeError;

View File

@ -0,0 +1,46 @@
/*
* Copyright (c) 2024 Bitdefender
* SPDX-License-Identifier: Apache-2.0
*/
//! Offers information about the SIMD exceptions that can be triggered by an instruction.
#![allow(clippy::module_name_repetitions)]
// TODO: maybe use something like the `bitflags` crate and have all these as flags?
/// SIMD Floating-Point Exceptions.
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
pub struct SimdExceptions {
/// Invalid Operation Exception.
pub invalid_operation: bool,
/// Denormal Exception.
pub denormal: bool,
/// Divide-by-Zero Exception.
pub divide_by_zero: bool,
/// Overflow Exception.
pub overflow: bool,
/// Underflow Exception.
pub underflow: bool,
/// Precision Exception.
pub precision: bool,
}
#[doc(hidden)]
impl SimdExceptions {
pub(crate) fn from_raw(value: u8) -> Self {
let value = u32::from(value);
Self {
invalid_operation: (value & ffi::ND_SIMD_EXC_IE) != 0,
denormal: (value & ffi::ND_SIMD_EXC_DE) != 0,
divide_by_zero: (value & ffi::ND_SIMD_EXC_ZE) != 0,
overflow: (value & ffi::ND_SIMD_EXC_OE) != 0,
underflow: (value & ffi::ND_SIMD_EXC_UE) != 0,
precision: (value & ffi::ND_SIMD_EXC_PE) != 0,
}
}
}