mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-13 07:32:23 -07:00
fix 64-bit bitfield type value evaluation mask/shift
This commit is contained in:
@@ -170,7 +170,7 @@ e_value_eval_from_eval(E_Eval eval)
|
||||
U64 valid_bits_mask = 0;
|
||||
for(U64 idx = 0; idx < type->count; idx += 1)
|
||||
{
|
||||
valid_bits_mask |= (1<<idx);
|
||||
valid_bits_mask |= (1ull<<idx);
|
||||
}
|
||||
eval.value.u64 = eval.value.u64 >> type->off;
|
||||
eval.value.u64 = eval.value.u64 & valid_bits_mask;
|
||||
|
||||
@@ -91,6 +91,13 @@ struct TypeWithBitfield
|
||||
int z : 10;
|
||||
};
|
||||
|
||||
typedef struct BitfieldType64 BitfieldType64;
|
||||
struct BitfieldType64
|
||||
{
|
||||
uint64_t size : 63;
|
||||
uint64_t is_free : 1;
|
||||
};
|
||||
|
||||
void
|
||||
c_type_with_bitfield_usage(void)
|
||||
{
|
||||
@@ -103,4 +110,8 @@ c_type_with_bitfield_usage(void)
|
||||
int x = (b.v + b.x);
|
||||
int y = (b.y - b.z);
|
||||
int z = (b.w) + 5;
|
||||
BitfieldType64 b64 = {0};
|
||||
b64.size = 524288;
|
||||
b64.is_free = 1;
|
||||
int abc = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user