Hi,
        you should really consider to convert the 12 digit string to a 64bit 
struct
like 
typedef struct tagBigNum
{
        UInt32 hi; // first 6 digits
        UInt32 lo ; // last 6 digits
}
        BigNum ;

Holding an array of 12 byte strings would not be very effective (#items x 
12bytes. You could also sort the BigNum array and use SysBinarySearch instead 
of hashing. Anyway a good method for hashing numbers is to take the middle 
bits of the square, eg.   (x*x >> 4) & 0xFFFF. You could do this for both hi 
and lo and combine it to a long.

On Sunday 29 May 2005 17:11, Katie A. (Moor) Siek wrote:
> I'm trying to hash a string. It is a string of numbers, but the number
> is 12 digits long - too big for a Int32.
>
> Thanks,
> Katie
>
> On May 29, 2005, at 1:39 AM, Logan Shaw wrote:
> > Katie A. (Moor) Siek wrote:
> >> Also, does anyone know a good hash function that works on Palms?
> >
> > Surely that would depend on what kind data you're trying to hash...
> >
> > Strings?  Floating point numbers?  Prime numbers?  RGB values?
> > Pointers?
> >
> >   - Logan
> >
> > --
> > For information on using the PalmSource Developer Forums, or to
> > unsubscribe, please see http://www.palmos.com/dev/support/forums/
>
> *~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*
> Katie A. (Moor) Siek
> PhD Candidate                         (812) 856-2107
> Indiana University                            [EMAIL PROTECTED]
> Computer Science Department         http://www.cs.indiana.edu/~ksiek
> *~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*

-- 
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to