[tpm] OID sorting
Uri Guttman
uri at stemsystems.com
Fri May 1 13:46:29 PDT 2009
>>>>> "HB" == Henry Baragar <Henry.Baragar at instantiated.ca> writes:
HB> On May 1, 2009 04:30:51 pm Uri Guttman wrote:
>> AH> my @sortedpacked = sort { $a cmp $b} @packed;
>>
>> no need for the explicit cmp op as string compare is the default for
>> sort. i think recent perls do optimize this away but it isn't needed
>> anyway.
HB> I one of the issues from last night was that a numeric comparison was required
HB> (not a string one). That is "3" should precede "13".
that makes sense but the code showed string comparisons in the
schwartzian too. the packed sort always uses string compares as the
packed values are strings. you handle numeric comparisons by doing the
proper packing (small values into bytes, etc.). again, sort::maker
handles all of this for you.
uri
--
Uri Guttman ------ uri at stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
More information about the toronto-pm
mailing list