@@ -36,6 +36,7 @@ pub fn get_mnemnonic_data(name: &str) -> Option<&'static [Opdata]> {
36
36
}
37
37
38
38
bitflags ! {
39
+ #[ derive( Clone , Copy , Debug , Default , Eq , Hash , Ord , PartialEq , PartialOrd ) ]
39
40
pub struct Flags : u32 {
40
41
const DEFAULT = 0x0000_0000 ; // this instruction has default encoding
41
42
const VEX_OP = 0x0000_0001 ; // this instruction requires a VEX prefix to be encoded
@@ -72,11 +73,12 @@ bitflags! {
72
73
73
74
impl Flags {
74
75
const fn make ( bits : u32 ) -> Flags {
75
- Flags { bits }
76
+ Flags :: from_bits_truncate ( bits)
76
77
}
77
78
}
78
79
79
80
bitflags ! {
81
+ #[ derive( Clone , Copy , Debug , Default , Eq , Hash , Ord , PartialEq , PartialOrd ) ]
80
82
pub struct Features : u32 {
81
83
const X64_IMPLICIT = 0x0000_0000 ;
82
84
const FPU = 0x0000_0001 ;
@@ -109,7 +111,7 @@ bitflags! {
109
111
110
112
impl Features {
111
113
const fn make ( bits : u32 ) -> Features {
112
- Features { bits }
114
+ Features :: from_bits_truncate ( bits)
113
115
}
114
116
115
117
pub fn from_str ( name : & str ) -> Option < Features > {
@@ -188,59 +190,59 @@ pub fn mnemnonics() -> hash_map::Keys<'static, &'static str, &'static [Opdata]>
188
190
}
189
191
190
192
// workaround until bitflags can be used in const
191
- const DEFAULT : u32 = Flags :: DEFAULT . bits ;
192
- const VEX_OP : u32 = Flags :: VEX_OP . bits ;
193
- const XOP_OP : u32 = Flags :: XOP_OP . bits ;
194
- const IMM_OP : u32 = Flags :: IMM_OP . bits ;
195
- const SHORT_ARG : u32 = Flags :: SHORT_ARG . bits ;
196
- const AUTO_SIZE : u32 = Flags :: AUTO_SIZE . bits ;
197
- const AUTO_NO32 : u32 = Flags :: AUTO_NO32 . bits ;
198
- const AUTO_REXW : u32 = Flags :: AUTO_REXW . bits ;
199
- const AUTO_VEXL : u32 = Flags :: AUTO_VEXL . bits ;
200
- const WORD_SIZE : u32 = Flags :: WORD_SIZE . bits ;
201
- const WITH_REXW : u32 = Flags :: WITH_REXW . bits ;
202
- const WITH_VEXL : u32 = Flags :: WITH_VEXL . bits ;
203
- const EXACT_SIZE : u32 = Flags :: EXACT_SIZE . bits ;
204
- const PREF_66 : u32 = Flags :: PREF_66 . bits ;
205
- const PREF_67 : u32 = Flags :: PREF_67 . bits ;
206
- const PREF_F0 : u32 = Flags :: PREF_F0 . bits ;
207
- const PREF_F2 : u32 = Flags :: PREF_F2 . bits ;
208
- const PREF_F3 : u32 = Flags :: PREF_F3 . bits ;
209
- const LOCK : u32 = Flags :: LOCK . bits ;
210
- const REP : u32 = Flags :: REP . bits ;
211
- const REPE : u32 = Flags :: REPE . bits ;
212
- const ENC_MR : u32 = Flags :: ENC_MR . bits ;
213
- const ENC_VM : u32 = Flags :: ENC_VM . bits ;
214
- const ENC_MIB : u32 = Flags :: ENC_MIB . bits ;
215
- const X86_ONLY : u32 = Flags :: X86_ONLY . bits ;
193
+ const DEFAULT : u32 = Flags :: DEFAULT . bits ( ) ;
194
+ const VEX_OP : u32 = Flags :: VEX_OP . bits ( ) ;
195
+ const XOP_OP : u32 = Flags :: XOP_OP . bits ( ) ;
196
+ const IMM_OP : u32 = Flags :: IMM_OP . bits ( ) ;
197
+ const SHORT_ARG : u32 = Flags :: SHORT_ARG . bits ( ) ;
198
+ const AUTO_SIZE : u32 = Flags :: AUTO_SIZE . bits ( ) ;
199
+ const AUTO_NO32 : u32 = Flags :: AUTO_NO32 . bits ( ) ;
200
+ const AUTO_REXW : u32 = Flags :: AUTO_REXW . bits ( ) ;
201
+ const AUTO_VEXL : u32 = Flags :: AUTO_VEXL . bits ( ) ;
202
+ const WORD_SIZE : u32 = Flags :: WORD_SIZE . bits ( ) ;
203
+ const WITH_REXW : u32 = Flags :: WITH_REXW . bits ( ) ;
204
+ const WITH_VEXL : u32 = Flags :: WITH_VEXL . bits ( ) ;
205
+ const EXACT_SIZE : u32 = Flags :: EXACT_SIZE . bits ( ) ;
206
+ const PREF_66 : u32 = Flags :: PREF_66 . bits ( ) ;
207
+ const PREF_67 : u32 = Flags :: PREF_67 . bits ( ) ;
208
+ const PREF_F0 : u32 = Flags :: PREF_F0 . bits ( ) ;
209
+ const PREF_F2 : u32 = Flags :: PREF_F2 . bits ( ) ;
210
+ const PREF_F3 : u32 = Flags :: PREF_F3 . bits ( ) ;
211
+ const LOCK : u32 = Flags :: LOCK . bits ( ) ;
212
+ const REP : u32 = Flags :: REP . bits ( ) ;
213
+ const REPE : u32 = Flags :: REPE . bits ( ) ;
214
+ const ENC_MR : u32 = Flags :: ENC_MR . bits ( ) ;
215
+ const ENC_VM : u32 = Flags :: ENC_VM . bits ( ) ;
216
+ const ENC_MIB : u32 = Flags :: ENC_MIB . bits ( ) ;
217
+ const X86_ONLY : u32 = Flags :: X86_ONLY . bits ( ) ;
216
218
217
219
#[ allow( dead_code) ]
218
- const X64_IMPLICIT : u32 = Features :: X64_IMPLICIT . bits ;
219
- const FPU : u32 = Features :: FPU . bits ;
220
- const MMX : u32 = Features :: MMX . bits ;
221
- const TDNOW : u32 = Features :: TDNOW . bits ;
222
- const SSE : u32 = Features :: SSE . bits ;
223
- const SSE2 : u32 = Features :: SSE2 . bits ;
224
- const SSE3 : u32 = Features :: SSE3 . bits ;
225
- const VMX : u32 = Features :: VMX . bits ;
226
- const SSSE3 : u32 = Features :: SSSE3 . bits ;
227
- const SSE4A : u32 = Features :: SSE4A . bits ;
228
- const SSE41 : u32 = Features :: SSE41 . bits ;
229
- const SSE42 : u32 = Features :: SSE42 . bits ;
230
- const SSE5 : u32 = Features :: SSE5 . bits ;
231
- const AVX : u32 = Features :: AVX . bits ;
232
- const AVX2 : u32 = Features :: AVX2 . bits ;
233
- const FMA : u32 = Features :: FMA . bits ;
234
- const BMI1 : u32 = Features :: BMI1 . bits ;
235
- const BMI2 : u32 = Features :: BMI2 . bits ;
236
- const TBM : u32 = Features :: TBM . bits ;
237
- const RTM : u32 = Features :: RTM . bits ;
238
- const INVPCID : u32 = Features :: INVPCID . bits ;
239
- const MPX : u32 = Features :: MPX . bits ;
240
- const SHA : u32 = Features :: SHA . bits ;
241
- const PREFETCHWT1 : u32 = Features :: PREFETCHWT1 . bits ;
242
- const CYRIX : u32 = Features :: CYRIX . bits ;
243
- const AMD : u32 = Features :: AMD . bits ;
220
+ const X64_IMPLICIT : u32 = Features :: X64_IMPLICIT . bits ( ) ;
221
+ const FPU : u32 = Features :: FPU . bits ( ) ;
222
+ const MMX : u32 = Features :: MMX . bits ( ) ;
223
+ const TDNOW : u32 = Features :: TDNOW . bits ( ) ;
224
+ const SSE : u32 = Features :: SSE . bits ( ) ;
225
+ const SSE2 : u32 = Features :: SSE2 . bits ( ) ;
226
+ const SSE3 : u32 = Features :: SSE3 . bits ( ) ;
227
+ const VMX : u32 = Features :: VMX . bits ( ) ;
228
+ const SSSE3 : u32 = Features :: SSSE3 . bits ( ) ;
229
+ const SSE4A : u32 = Features :: SSE4A . bits ( ) ;
230
+ const SSE41 : u32 = Features :: SSE41 . bits ( ) ;
231
+ const SSE42 : u32 = Features :: SSE42 . bits ( ) ;
232
+ const SSE5 : u32 = Features :: SSE5 . bits ( ) ;
233
+ const AVX : u32 = Features :: AVX . bits ( ) ;
234
+ const AVX2 : u32 = Features :: AVX2 . bits ( ) ;
235
+ const FMA : u32 = Features :: FMA . bits ( ) ;
236
+ const BMI1 : u32 = Features :: BMI1 . bits ( ) ;
237
+ const BMI2 : u32 = Features :: BMI2 . bits ( ) ;
238
+ const TBM : u32 = Features :: TBM . bits ( ) ;
239
+ const RTM : u32 = Features :: RTM . bits ( ) ;
240
+ const INVPCID : u32 = Features :: INVPCID . bits ( ) ;
241
+ const MPX : u32 = Features :: MPX . bits ( ) ;
242
+ const SHA : u32 = Features :: SHA . bits ( ) ;
243
+ const PREFETCHWT1 : u32 = Features :: PREFETCHWT1 . bits ( ) ;
244
+ const CYRIX : u32 = Features :: CYRIX . bits ( ) ;
245
+ const AMD : u32 = Features :: AMD . bits ( ) ;
244
246
245
247
246
248
lazy_static ! {
0 commit comments