search for: base_int

Displaying 3 results from an estimated 3 matches for "base_int".

Did you mean: base_id
2018 Mar 19
4
RFC: Devirtualization v2
...his will also work.void ptr_to_int() { A *a = new A; a->foo(); A *b = new(a) B; auto av = (uintptr_t)a; auto bv = (uintptr_t)b; if (av == bv) b->foo();}int to ptrHere because we are creating a fat pointer from integer, we need to use launder:void foo(Base *base) { uintptr_t base_int = (uintptr_t)base; /* base_int = ptrtoint (strip base) */ Base *base_int_ptr = (Base*)base_int; /* base_int_ptr = inttoptr base_int = inttoptr (ptrtoint (strip base)) = strip base */ base_int_ptr->vfun(); ... Derived *derived = std::launder(base); uintptr_t derived_int = (uintptr_t)derive...
2018 Mar 28
0
[cfe-dev] RFC: Devirtualization v2
...A *b = new(a) B; > auto av = (uintptr_t)a; > auto bv = (uintptr_t)b; > if (av == bv) > b->foo(); > } > > > int to ptr > Here because we are creating a fat pointer from integer, we need to use launder: > > void foo(Base *base) { > uintptr_t base_int = (uintptr_t)base; > /* base_int = ptrtoint (strip base) */ > Base *base_int_ptr = (Base*)base_int; > /* base_int_ptr = inttoptr base_int = inttoptr (ptrtoint (strip base)) = strip base */ > base_int_ptr->vfun(); > ... > Derived *derived = std::launder(base); >...
2018 Mar 29
2
[cfe-dev] RFC: Devirtualization v2
...oid ptr_to_int() { A > *a = new A; a->foo(); A *b = new(a) B; auto av = (uintptr_t)a; auto > bv = (uintptr_t)b; if (av == bv) b->foo();}int to ptrHere because > we are creating a fat pointer from integer, we need to use launder:void > foo(Base *base) { uintptr_t base_int = (uintptr_t)base; /* base_int = > ptrtoint (strip base) */ Base *base_int_ptr = (Base*)base_int; /* > base_int_ptr = inttoptr base_int = inttoptr (ptrtoint (strip base)) = strip > base */ base_int_ptr->vfun(); ... Derived *derived = std::launder(base); > uintptr_t derived_int...