×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Thanks Mel,

I'll keep this in mind, 'cause time could be critical in production.

Best regards,
Leif
----- Original Message ----- 
From: "Mel Rothman" <mel@xxxxxxxxxxxxxx>
To: <rpg400-l@xxxxxxxxxxxx>
Sent: 10. april 2006 00:10
Subject: Re: Convert from Hex to Binary....


> For what it's worth, the array method I suggested is a little faster than 
> using cvtch and 
> itoa.
> 
> itoa does not left pad results that have fewer than 8 binary digits. For 
> example x'01' 
> comes back as 1; x'02' comes back as '10', etc.
> 
> Here are my test results for 160,000 iterations using each of three different 
> subprocedures:
> 
> 0.960632 seconds - Using arrays
> 
> 1.063816 seconds - using cvtch and itoa without padding '0's on the left
> 
> 1.225792 seconds - using cvtch and itoa with additional logic to pad '0's on 
> the left.
> I used the following instructions, where int1 is the one byte returned by 
> cvtch in 3i 0 
> format, string9 is 9 characters and rtn is 8 characters:
> evalr rtn = %str(itoa(int1:string9:2));
> return %xlate(' ':'0':rtn);
> 
> CGIDEV2's timerStart and timerEelapsed subprocedures were used for timing.
> 
> Mel Rothman
> Mel Rothman, Inc.
> 
> Leif Guldbrand wrote:
> > Thanks for the answers from Jonathan, Mel and Bob,
> > 
> > I have the program up'n running now.... :-)
> > 
> > Bob...: 
> >> I'll convert it for you.
> > 
> > Thanks... a great offer, but I like to do it myself with some
> > help now and then :-)  - - - - but I used your suggestion.
> > 
> > Best regards,
> > Leif
> > 
> > 
> 
> -- 
> This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
> To post a message email: RPG400-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
> or email: RPG400-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/rpg400-l.
> 
> 
> 



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.