Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Compress positive integers

by ikegami (Patriarch)
on Apr 07, 2008 at 23:08 UTC ( [id://678854]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    1 byte:                       0..127
    2 bytes:                    128..etc
    ...
    7 bytes:      4_398_046_511_104
    8 bytes:    562_949_953_421_312
    9 bytes: 72_057_594_037_927_936
    
  2. or download this
    sub compress_uint {
       my ($uint) = @_;
    ...
    for (100, 1000, 100000) {
       print $fh compress_uint($_);
    }
    
  3. or download this
    sub decompress_uint {
       our $compressed; local *compressed = \($_[0]);
    ...
    while (length($raw)) {
       push @nums, decompress_uint($raw);
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://678854]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2024-04-23 21:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found