Welcome BrianP,

On a Linux 32 bit system, Perl still allows 2**53 integers if you compile Perl for 64 bit integers: (Note: If Perl is a 64 bit version, then the problem goes away!)

rperl -e 'use integer;$i=((2**17)**3);$m=2**53;print "$i\n$m\n";' 2251799813685248 9007199254740992
As you can see the maximum integer is larger than what you need. So you can generate integers directly by multiplying the 3 16 bit
<UPDATE>
To make sure nobody just multiplies the RGB together please remember that to represent the number 307 in decimal use:
perl -e '$n = (3*(10**2)) + (0*(10**1)) + (9*(10**0)); print "$n\n";'
So the formula is ($B is the base):
perl -e '$B = 10; $n = (3*($B**2)) + (0*($B**1)) + (9*($B**0)); print +"$n\n";'
So to generate 48 bit RGB integers you need:
perl -e '$B = 2**16; $n = ($R*($B**2)) + ($G*($B**1)) + ($B*($B**0)); +print "$n\n";'
Clarification complete!
</UPDATE>
values and then use that value as a hash key. Then each time you add a count just do:
$hash{$key}++; ## $key is 48 bit RGB as a single integer ## The value $hash{$key} is sum of the time +s found

Regards...Ed

"Well done is better than well said." - Benjamin Franklin


In reply to Re: Perl Hashes in C? (Updated) by flexvault
in thread Perl Hashes in C? by BrianP

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.