Hi, On Sat, 7 Jun 2008, Pieter de Bie wrote: > On 7 jun 2008, at 01:09, Junio C Hamano wrote: > > >I am confused. > > > >The type of object_decoration.decorattion is a (void*). Why isn't it > >sufficient to do it in a naïve and straightforward way? > > > > mark = (uint32_t)(deco->decoration); > > add_decoration(&idnums, object, (void*) mark); > > > >Is this twisted pointer arithmetic done in order to avoid cast between > >int and pointer of different size in the code? Yes, it was done in response to a remark that pointers might not be allowed to be unaligned. > I'm not sure why this is done; I simply copied what the existing code > already did. Okay, I looked again, and indeed, you _copied_ it. Instead of using the functions mark_object() and get_object_mark() which are there only to be used by you. So please fix. > >Even if that is the case, doesn't "(uint32_t *)deco->decoration - > >(uint32_t *)NULL" mean the value range for deco->decoration is > >one-fourth of U32? It is. But since every object needs already at least 20 bytes, and we do not even have the complete address space to put objects into, and we do not plan to support 64-bit only repositories, I think we are fine. At least for the moment. Ciao, Dscho