aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib.rs2
-rw-r--r--src/long_mode/mod.rs2
-rw-r--r--src/protected_mode/mod.rs2
-rw-r--r--src/real_mode/mod.rs2
-rw-r--r--src/safer_unchecked.rs30
5 files changed, 3 insertions, 35 deletions
diff --git a/src/lib.rs b/src/lib.rs
index a7b8531..836a50c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -138,8 +138,6 @@ pub use protected_mode::Arch as x86_32;
pub mod real_mode;
pub use real_mode::Arch as x86_16;
-mod safer_unchecked;
-
const MEM_SIZE_STRINGS: [&'static str; 65] = [
"BUG",
"byte", "word", "BUG", "dword", "ptr", "far", "BUG", "qword",
diff --git a/src/long_mode/mod.rs b/src/long_mode/mod.rs
index 114ee6d..5a3dc51 100644
--- a/src/long_mode/mod.rs
+++ b/src/long_mode/mod.rs
@@ -12,11 +12,11 @@ pub use self::display::{DisplayStyle, InstructionDisplayer};
pub use self::display::InstructionTextBuffer;
use core::cmp::PartialEq;
-use crate::safer_unchecked::unreachable_kinda_unchecked as unreachable_unchecked;
use yaxpeax_arch::{AddressDiff, Decoder, Reader, LengthedInstruction};
use yaxpeax_arch::annotation::{AnnotatingDecoder, DescriptionSink, NullSink};
use yaxpeax_arch::{DecodeError as ArchDecodeError};
+use yaxpeax_arch::safer_unchecked::unreachable_kinda_unchecked as unreachable_unchecked;
use core::fmt;
impl fmt::Display for DecodeError {
diff --git a/src/protected_mode/mod.rs b/src/protected_mode/mod.rs
index ff96a03..b02079e 100644
--- a/src/protected_mode/mod.rs
+++ b/src/protected_mode/mod.rs
@@ -12,11 +12,11 @@ pub use self::display::{DisplayStyle, InstructionDisplayer};
pub use self::display::InstructionTextBuffer;
use core::cmp::PartialEq;
-use crate::safer_unchecked::unreachable_kinda_unchecked as unreachable_unchecked;
use yaxpeax_arch::{AddressDiff, Decoder, Reader, LengthedInstruction};
use yaxpeax_arch::annotation::{AnnotatingDecoder, DescriptionSink, NullSink};
use yaxpeax_arch::{DecodeError as ArchDecodeError};
+use yaxpeax_arch::safer_unchecked::unreachable_kinda_unchecked as unreachable_unchecked;
use core::fmt;
impl fmt::Display for DecodeError {
diff --git a/src/real_mode/mod.rs b/src/real_mode/mod.rs
index 018b5f6..e34444e 100644
--- a/src/real_mode/mod.rs
+++ b/src/real_mode/mod.rs
@@ -12,11 +12,11 @@ pub use self::display::{DisplayStyle, InstructionDisplayer};
pub use self::display::InstructionTextBuffer;
use core::cmp::PartialEq;
-use crate::safer_unchecked::unreachable_kinda_unchecked as unreachable_unchecked;
use yaxpeax_arch::{AddressDiff, Decoder, Reader, LengthedInstruction};
use yaxpeax_arch::annotation::{AnnotatingDecoder, DescriptionSink, NullSink};
use yaxpeax_arch::{DecodeError as ArchDecodeError};
+use yaxpeax_arch::safer_unchecked::unreachable_kinda_unchecked as unreachable_unchecked;
use core::fmt;
impl fmt::Display for DecodeError {
diff --git a/src/safer_unchecked.rs b/src/safer_unchecked.rs
deleted file mode 100644
index 34216bc..0000000
--- a/src/safer_unchecked.rs
+++ /dev/null
@@ -1,30 +0,0 @@
-use core::slice::SliceIndex;
-
-pub trait GetSaferUnchecked<T> {
- unsafe fn get_kinda_unchecked<I>(&self, index: I) -> &<I as SliceIndex<[T]>>::Output
- where
- I: SliceIndex<[T]>;
-}
-
-impl<T> GetSaferUnchecked<T> for [T] {
- #[inline(always)]
- unsafe fn get_kinda_unchecked<I>(&self, index: I) -> &<I as SliceIndex<[T]>>::Output
- where
- I: SliceIndex<[T]>,
- {
- if cfg!(debug_assertions) {
- &self[index]
- } else {
- self.get_unchecked(index)
- }
- }
-}
-
-#[inline(always)]
-pub unsafe fn unreachable_kinda_unchecked() -> ! {
- if cfg!(debug_assertions) {
- panic!("UB: Unreachable unchecked was executed")
- } else {
- core::hint::unreachable_unchecked()
- }
-}