This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/4] Add an abstract incremental hash data type


> +++ b/gcc/inchash.h
> +class inchash
> +{
> +  hashval_t val;

normal style would be explicit private: at the end.

> + public:
> +
> +  /* Start incremential hashing, optionally with SEED.  */
> +  void begin (hashval_t seed = 0)
> +  {
> +    val = seed;

why isn't this the ctor?

> +  /* Add unsigned value V.  */
> +  void add_int (unsigned v)
> +  {
> +    val = iterative_hash_hashval_t (v, val);
> +  }

istm this is a great spot to provide a bunch of overloads of just add()
and let the compiler pick the appropriate one for your type.

thanks!

Trev


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]