XP is just a number | |
PerlMonks |
Re: 3-byte representationby cavac (Parson) |
on Oct 12, 2011 at 16:38 UTC ( [id://931055]=note: print w/replies, xml ) | Need Help?? |
Edit: Ooops, my code only works for unsigned integers. I'll leave it here anyway, might at least come in handy for someone else at a later time...
Ok, Here's a simple example of how i did it as a test:
Here's the output: I'm pretty sure there is a better way, but i'm not an expert on all this math stuff... Edit: If you have a lot of numbers to encode/decode, you might want to consider putting that stuff into a C module or use Inline::C for speed.
Don't use '#ff0000': use Acme::AutoColor; my $redcolor = RED(); All colors subject to change without notice.
In Section
Seekers of Perl Wisdom
|
|