mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-06 13:58:40 +00: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;
|
U64 valid_bits_mask = 0;
|
||||||
for(U64 idx = 0; idx < type->count; idx += 1)
|
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 >> type->off;
|
||||||
eval.value.u64 = eval.value.u64 & valid_bits_mask;
|
eval.value.u64 = eval.value.u64 & valid_bits_mask;
|
||||||
|
|||||||
@@ -91,6 +91,13 @@ struct TypeWithBitfield
|
|||||||
int z : 10;
|
int z : 10;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef struct BitfieldType64 BitfieldType64;
|
||||||
|
struct BitfieldType64
|
||||||
|
{
|
||||||
|
uint64_t size : 63;
|
||||||
|
uint64_t is_free : 1;
|
||||||
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
c_type_with_bitfield_usage(void)
|
c_type_with_bitfield_usage(void)
|
||||||
{
|
{
|
||||||
@@ -103,4 +110,8 @@ c_type_with_bitfield_usage(void)
|
|||||||
int x = (b.v + b.x);
|
int x = (b.v + b.x);
|
||||||
int y = (b.y - b.z);
|
int y = (b.y - b.z);
|
||||||
int z = (b.w) + 5;
|
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