[FFmpeg-devel] pre discussion around Blackfin dct_quantize_bfin routine

Måns Rullgård mans
Tue Jun 12 15:17:36 CEST 2007


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.

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-devel mailing list