[SeaBIOS] SeaBIOS crashes on CBFS without legacy header
Kevin O'Connor
kevin at koconnor.net
Tue Dec 29 03:14:42 CET 2015
On Mon, Dec 28, 2015 at 04:09:22PM -0800, Alex G. wrote:
> > Are you suggesting that an (unsigned) cast should be added? I doubt
> > it would matter.
>
> I'm suggesting to not rely on (0 - 4) to produce 0xfffffffc. The
> (unsigned) cast does not solve the C issue of writing a negative value
> into an unsigned type.
FYI, assigning "0 - 4" to an unsigned integer is not undefined. From
the C11 spec, section 6.3.1.3:
1 When a value with integer type is converted to another integer type
other than _Bool, if the value can be represented by the new type,
it is unchanged.
2 Otherwise, if the new type is unsigned, the value is converted by
repeatedly adding or subtracting one more than the maximum value
that can be represented in the new type until the value is in the
range of the new type.
-Kevin
More information about the SeaBIOS
mailing list