|
|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 4096 (0x1000)
Types: Ada Source
Notes: 03_class, FILE, R1k_Segment, e3_tag, function Vstring_Hash, seg_00583b
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
└─⟦5a81ac88f⟧ »Space Info Vol 1«
└─⟦this⟧
with Arithmetic;
use Arithmetic;
with Vstring_Type;
use Vstring_Type;
------------------------------------------------------------------------------
-- Copyright 1988 - 1991 by Rational, Santa Clara, California.
--
-- All Rights Reserved.
--
-- Permission to use, copy, modify, and distribute this software and its
-- documentation for any purpose and without fee is hereby granted,
-- provided that the above copyright notice(s) appear in all copies and that
-- both that copyright notice(s) and this permission notice appear in
-- supporting documentation, and that the name of Rational not be used in
-- advertising or publicity pertaining to distribution of the software
-- without specific, written prior permission.
--
-- Rational disclaims all warranties with regard to this software, including
-- all implied warranties of merchantability and fitness, in no event shall
-- Rational be liable for any special, indirect or consequential damages or
-- any damages whatsoever resulting from loss of use, data or profits, whether
-- in an action of contract, negligence or other tortious action, arising out
-- of or in connection with the use or performance of this software.
------------------------------------------------------------------------------
function Vstring_Hash (Vstr : Vstring_Data) return S_Natural is
------------------------------------------------------------------------------
-- Vstr - Specifies the string to hash
--
-- Computes a numeric value based upon the contents of the Vstring.
------------------------------------------------------------------------------
Hash : S_Natural := 0;
Tmp : S_Natural := 0;
Pos : S_Natural := 1;
begin
----Loop over the entire contents. Take each character and add it into the
-- hash. Take care not to overflow.
while Pos < Vstr.Length loop
if Tmp > (S_Natural'Last - Character'Pos (Character'Last)) / 3 then
if S_Natural'Last - Hash < Tmp then
Hash := Hash / 2 + Tmp;
else
Hash := Hash + Tmp;
end if;
Tmp := 0;
end if;
Tmp := Tmp * 3 + Character'Pos (Vstr.Chars (Pos));
Pos := Pos + 1;
end loop;
---Add in any remaining hash bits and return.
if S_Natural'Last - Hash < Tmp then
Hash := Hash / 2 + Tmp;
else
Hash := Hash + Tmp;
end if;
return Hash;
end Vstring_Hash;
nblk1=3
nid=0
hdr6=6
[0x00] rec0=16 rec1=00 rec2=01 rec3=096
[0x01] rec0=16 rec1=00 rec2=02 rec3=022
[0x02] rec0=15 rec1=00 rec2=03 rec3=000
tail 0x21500af5281978f0ba681 0x42a00088462063203