[pisa-src] Re: r1640 - trunk/libpisa/checksum.h

  • From: Diego Biurrun <diego@xxxxxxxxxx>
  • To: pisa-src@xxxxxxxxxxxxx
  • Date: Wed, 11 Nov 2009 14:21:56 +0100

On Wed, Nov 11, 2009 at 02:10:33PM +0100, Thomas Jansen wrote:
> 
> Log:
> pisa_csum_fold should return pisa_csum16 rather than uint16_t.
> 
> --- trunk/libpisa/checksum.h  Wed Nov 11 12:38:05 2009        (r1639)
> +++ trunk/libpisa/checksum.h  Wed Nov 11 14:10:32 2009        (r1640)
> @@ -13,6 +13,8 @@
>  
> +/* TODO: needs to include a header for uint{16,32}_t to be selfcontained */

The header that contains the typedefs for uint16_t?
That header would be stdint.h.

>  typedef uint16_t pisa_csum16;
>  typedef uint32_t pisa_csum32;

I think such typedefs are harmful obfuscation.  Now if I read a function
that uses pisa_csum32 I have to read some context to understand it
completely.  Why would we need such an extra layer of indirection?

> @@ -21,7 +23,7 @@
> -static inline uint16_t pisa_csum_fold(pisa_csum32 c)
> +static inline pisa_csum16 pisa_csum_fold(pisa_csum32 c)

As I said, I think this was more readable before.

Diego

Other related posts: