osom_asm_x86_64/models/
gpr_kind.rs1#![allow(non_upper_case_globals)]
2
3use super::Size;
4use osom_encoders_x86_64::models as enc_models;
5
6#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
8#[repr(transparent)]
9#[must_use]
10pub struct GPRKind {
11 value: enc_models::GPRKind,
12}
13
14impl GPRKind {
15 pub const Bit8High: Self = Self::new(enc_models::GPRKind::Bit8High);
17
18 pub const Bit8: Self = Self::new(enc_models::GPRKind::Bit8);
20
21 pub const Bit16: Self = Self::new(enc_models::GPRKind::Bit16);
23
24 pub const Bit32: Self = Self::new(enc_models::GPRKind::Bit32);
26
27 pub const Bit64: Self = Self::new(enc_models::GPRKind::Bit64);
29
30 #[inline(always)]
31 pub(crate) const fn new(gpr: enc_models::GPRKind) -> Self {
32 Self { value: gpr }
33 }
34
35 #[inline(always)]
36 pub const fn size(self) -> Size {
37 Size::new(self.value.size())
38 }
39
40 #[inline(always)]
41 #[must_use]
42 pub const fn equals(self, other: Self) -> bool {
43 self.value.equals(other.value)
44 }
45
46 #[inline(always)]
47 pub(crate) fn as_enc_gpr_kind(self) -> enc_models::GPRKind {
48 self.value
49 }
50}
51
52impl From<enc_models::GPRKind> for GPRKind {
53 #[inline(always)]
54 fn from(gpr: enc_models::GPRKind) -> Self {
55 Self { value: gpr }
56 }
57}
58
59impl From<GPRKind> for enc_models::GPRKind {
60 #[inline(always)]
61 fn from(gpr: GPRKind) -> Self {
62 gpr.value
63 }
64}