comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adambeneschan@aol.com>
Subject: Re: FNV-1
Date: Wed, 30 Oct 2013 17:03:11 -0700 (PDT)
Date: 2013-10-30T17:03:11-07:00	[thread overview]
Message-ID: <87a31163-91a2-471a-9b98-8f5b1414037e@googlegroups.com> (raw)
In-Reply-To: <f81bc576-54b0-47c4-8c01-2581a12a5b53@googlegroups.com>

On Wednesday, October 30, 2013 4:31:39 PM UTC-7, sbelm...@gmail.com wrote:

>    subtype FNV_Offset_Type is FNV_Hash_Type range 1 .. FNV_Hash_Type'Last;

>    K_Offset : constant := (case FNV_Offset_Type'Size is
>                            when   32 => Offset_32, 
>                            when   64 => Offset_64, 
>                            when  128 => Offset_128,
>                            when  256 => Offset_256,
>                            when  512 => Offset_512,
>                            when 1024 => Offset_1024,
>                            when others => 0);

I'd worry about whether this is correct.  The Implementation Advice in 13.3(55) says about 'Size:

"The Size (if not specified) of a static discrete or fixed point subtype should be the number of bits needed to represent each value belonging to the subtype using an unbiased representation, leaving space for a sign bit only if the subtype contains negative values."

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.

                                   -- Adam
 

  reply	other threads:[~2013-10-31  0:03 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 ` Adam Beneschan [this message]
2013-10-31  0:03   ` FNV-1 Adam Beneschan
2013-10-31 19:46   ` FNV-1 sbelmont700
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