Broken dbus
Steven Moix
steven.moix at axianet.ch
Mon Apr 28 16:33:10 UTC 2008
Heh! Thanks for this very complete and clear explanation :)
Steven
On Sun, 2008-04-27 at 11:05 -0400, Jay Estabrook wrote:
> Sigh...
>
> I knew it was too early on a Sunday morning for this... ;-}
>
> Estabrook, Jay wrote:
> >
> > The poor programming practice (hal) arises from assuming that all
> > architectures have a natural boundary of 32-bits. Something like
> > the following are indicative:
> >
> > pointer = (void *)((((char *)address) + 3) & ~3);
>
> Should be:
>
> pointer = (void *)((((char *)address) + 4) & ~3);
>
> which rounds UP to the next 32-bit natural boundary.
>
> >
> > Better is:
> >
> > #define SZM (sizeof(void*)-1)
> > pointer = (void *)((((char *)address) + SZM) & ~SZM);
>
> And this should be:
>
> #define SZ (sizeof(void*))
> #define SZM (SZ-1)
> pointer = (void *)((((char *)address) + SZ) & ~SZM);
>
> which also rounds UP.
>
> Now back to the funny pages... ;-}
>
> --Jay++
>
> _______________________________________________
> axp-list mailing list
> axp-list at redhat.com
> https://www.redhat.com/mailman/listinfo/axp-list
More information about the axp-list
mailing list