SZEDER Gábor <szeder....@gmail.com> writes:

> So, 'test oidmap' from the previous patch prints the value we want to
> check with:
>
>     printf("%u\n", sha1hash(oid.hash));
>
> First, since object ids inherently make more sense as hex values, it
> would be more appropriate to print that hash with the '%x' format
> specifier, and then we wouldn't need Perl's hex() anymore, and thus
> could swap the order of the first four bytes in oidmap's hash without
> relying on Perl, e.g. with:
>
>   sed -e 's/^\(..\)\(..\)\(..\)\(..\).*/\4\3\2\1/'
>
> Second, and more importantly, the need for swapping the byte order
> indicates that this test would fail on big-endian systems, I'm afraid.
> So I think we need an additional bswap32() on the printing side, and
> then could further simplify 'test_oidhash':

Yup, if we are doing an ad-hoc t/helper/ command, we should strive
to make it help the driving scripts around it to become simpler, and
your suggestion to do s/%u/%x/ is a good example of doing so.

Thanks for a dose of sanity.  The goal of the series may be
worthwhile, and helping hands in improving its execution is very
much appreciated.

Reply via email to