2011/6/19 Måns Rullgård <[email protected]>: > Måns Rullgård <[email protected]> writes: > >> Alex Converse <[email protected]> writes: >> >>> On Sat, Jun 18, 2011 at 3:11 PM, Alex Converse <[email protected]> >>> wrote: >>>> On Sat, Jun 18, 2011 at 2:03 PM, Alex Converse <[email protected]> >>>> wrote: >>> [...] >>>>> >>>>> Because signed integer representation (two's complement; ones's >>>>> complement; sign magnitude) is implementation defined this also needs >>>>> to to be implementation defined. >>>>> >>>>> See also: >>>>> >>>>> 6.5.4 >>>>>> Some operators (the unary operator ~, and the binary operators <<, >>, >>>>>> &, ^, and |, >>>>>> collectively described as bitwise operators) are required to have >>>>>> operands that have >>>>>> integer type. These operators yield values that depend on the internal >>>>>> representations of >>>>>> integers, and have implementation-defined and undefined aspects for >>>>>> signed types. >>>>> >>>>> Yet we allow all of these >>>>> >>>> >>>> Feel free to propose a better solution. >>> >>> ping? >> >> A safe method (on 2's complement machines, which we assume) is to use a >> union: >> >> static inline int u2s(unsigned x) >> { >> union { unsigned u; int i; } v = { x }; >> return v.i; >> } >> >> GCC and a few other compilers I tested compile this to nothing, as expected. > > So you scream at this... > > Fine, have it your way. Go ahead and commit the damn cast, but don't > blame me when it breaks. >
I had a laundry list of things to do for libav this weekend and dealing with your bullshit on this has cost me a significant portion of time to spend on it and erased my motivation to work on the rest. _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
