URL
https://opencores.org/ocsvn/scarts/scarts/trunk
Subversion Repositories scarts
[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [testsuite/] [g++.old-deja/] [g++.robertl/] [eb112.C] - Rev 12
Compare with Previous | Blame | View Log
// { dg-do assemble }
template <class STRUCT, class MEMBER> inline STRUCT *
setback(MEMBER *bp, MEMBER STRUCT::*offset)
{
// The implementation of this function may be platform dependend
if(!bp) return 0; // NULL pointers remain NULL
union { int i; MEMBER STRUCT::*of; } u; // Switch types. Casting won't work.
u.of = offset;
return (STRUCT *) ((int) bp - u.i);
}