[FFmpeg-devel] pre discussion around Blackfin dct_quantize_bfin routine

Marc Hoffman mmhoffm
Tue Jun 12 15:27:22 CEST 2007


Hey Mans,

On 6/12/07, M?ns Rullg?rd <mans at mansr.com> wrote:
>
> Marc Hoffman wrote:
>
> > +static inline uint64_t read_time(void)
> > +{
> > +    union {
> > +        struct {
> > +            unsigned lo;
> > +            unsigned hi;
> > +        } p;
> > +        unsigned long long c;
> > +    } t;
> > +    asm volatile ("%0=cycles; %1=cycles2;" : "=d" (t.p.lo), "=d" (t.p.hi));
> > +    return t.c;
> > +}
>
> Using unions like that isn't allowed by the C standard.  It usually works,
> but there are no guarantees.  In fact, I've seen such things break in nasty
> ways.
>

O really, I have never seen such a problem interesting.  Anyways I'm
sure it exists, however this is for a specific machine which I know
this works for.  Based on that fact what are your thought, or do you
have a suggestion other than the wasteful use of electrons:  hi<<32ll
| lo?

Marc




More information about the ffmpeg-devel mailing list