sgifford has asked for the wisdom of the Perl Monks concerning the following question:
I'm working on some Perl modules to handle RFID tags. The tag IDs can be up to 96 bits. I'm not sure what the best way to accept these IDs as parameters, and return them, and wanted to ask for some ideas.
Right now, I'm just accepting and returning hex strings, and treating the tag IDs as somewhat opaque strings. But it's possible somebody will want to do bitwise operations on the tags (e.g. to & it with some mask), in which case they have to convert them from hex into something they can compute with. And my module is spending a lot of time converting to and from hex.
Math::BigInt seems like overkill for this, since for the most part representing the tags as strings will work fine. And using pack and unpack makes them unprintable, which is annoying.
So my question is, if you were using a module that dealt with a 96-bit ID number in various ways, what would you find the most convenient representation to work with? Or, if you were designing a module that had to work with 96-bit ID numbes, what factors would you take into consideration when thinking about the representation?
Any thoughts are appreciated!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Best way to represent somewhat large values in a module
by tachyon (Chancellor) on Jun 19, 2004 at 06:57 UTC | |
by sgifford (Prior) on Jun 19, 2004 at 10:11 UTC | |
by tachyon (Chancellor) on Jun 19, 2004 at 10:16 UTC | |
|
Re: Best way to represent somewhat large values in a module
by Zaxo (Archbishop) on Jun 19, 2004 at 06:15 UTC | |
|
Re: Best way to represent somewhat large values in a module
by wufnik (Friar) on Jun 19, 2004 at 17:40 UTC |