avoid 31-bit truncation in write_loose_object