c - How is negative zero used in this context? -
struct in_addr ipv4; ipv4.s_addr = (uint32_t)(-0)
that's strange, arithmetic implemented through two's complement don't have negative representation of 0
.
in one's complement version negative 0
instead stored 0xffffffff
have 255.255.255.255
when converted ipv4 address after cast unsigned int.
while in normal architecture using -0
cast unsigned int should give 0x00000000
.
Comments
Post a Comment