On Sun, May 20, 2012 at 10:37:00PM +0200, Bastian Blank wrote: > On Sun, May 20, 2012 at 10:22:58PM +0200, Philipp Kern wrote: > > you cannot reinterpret a size_t as an int. size_t might be unsigned, might > > have another length, etc. On 64bit big endian you fill the top bits and > > leave the lower ones untouched, because size_t is 64bit. So yeah, that code > > was broken. (nbd had something similar, glib too. I don't know why it only > > turns up with 64bit big endian.) > Because on little endian 64bit, it touches the lower bytes.
Yeah, but that assumes that the other ones are 0? Or ok, maybe it's just working when going from size_t to int, because it's truncation, but it shouldn't work for the other way round? Kind regards Philipp Kern
signature.asc
Description: Digital signature