comp.lang.ada
 help / color / mirror / Atom feed
From: sbelmont700@gmail.com
Subject: Re: FNV-1
Date: Thu, 31 Oct 2013 12:46:06 -0700 (PDT)
Date: 2013-10-31T12:46:06-07:00	[thread overview]
Message-ID: <579437d2-b330-46b2-90cd-0c3b8fcd43ac@googlegroups.com> (raw)
In-Reply-To: <87a31163-91a2-471a-9b98-8f5b1414037e@googlegroups.com>

On Wednesday, October 30, 2013 8:03:11 PM UTC-4, Adam Beneschan wrote:
> 
> Since FNV_Offset_Subtype doesn't have negative values, this would make it seem that FNV_Offset_Type'Size is more likely to be 31, 63, 127, etc., instead of 32, 64, 128, etc., if the Implementation Advice is followed.  Or it could be something totally different depending on how FNV_Hash_Type'Last is defined.  Those would play havoc with the definition of K_Offset.  I'm not sure how to fix this portably.
> 

I was considering this, but convinced myself that since everything is still a modulus type, the extra bit would be required for the entire range (i.e. if you need 32 bits to hold 0..2**32-1, then you still need all 32 bits for 1..2**32-1).  I played around with a few different sizes, and GNAT seemed to give errors (and warnings) where needed, so I sort of let it lie.  As long non-powers of two end up with errors and warnings, I guess that's the important part.

I also tried to do it using the actual 'Modulus, however, I ran into overflows for the larger numbers using 32-bit compilers, and couldn't figure out a slick way to do an lg statically.

Thank you for your response.  I welcome any more suggestions or advice.

-sb


  parent reply	other threads:[~2013-10-31 19:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-30 23:31 FNV-1 sbelmont700
2013-10-31  0:03 ` FNV-1 Adam Beneschan
2013-10-31  0:03   ` FNV-1 Adam Beneschan
2013-10-31 19:46   ` sbelmont700 [this message]
2013-10-31 20:35     ` FNV-1 Adam Beneschan
2013-10-31 22:00       ` FNV-1 Jeffrey Carter
2013-11-01 13:40 ` FNV-1 Georg Bauhaus
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox