Converting Hexadecimal in Binary

Alejandro Tejada capellan2000 at yahoo.com
Sun Jan 11 16:59:09 EST 2004


on Sun, 11 Jan 2004
Wouter wrote:

> On my slower rig it this is a little faster:
> 
> repeat with i = 1 to length(asd) step 6
>      put 00 & char i to i+5 of asd after qwd
> end repeat
> put  binaryEncode("H*",qwd) into qwe

Extraordinary! This reduces the time in another 
150 milliseconds!!!

> changed to this may make it (a lot) quicker:
> ### = change
> on mouseUp
> 
>    --put the ticks into zxcv   ### old HC way :^)
>    put the millisecs into zap  ### if the img is
> small this shows more 
> exactly the difference
>    -- this line put the ticks into a variable to
> count the time
>    -- that takes to execute this handler. There are
> 60 ticks in a second
> 
>    put the imagedata of img "prep" into asd
>    delete char 1 of asd
>    -- the first char of the imagedata is the
> alphadata or maskdata
> ###
>   get binaryDecode("H*",  asd, v1)
>   repeat with i = 1 to length(v1) step 8
>      put char i to i + 5 of  v1 after fldhex
>    end repeat
> ###
>    put length(fldhex) into lenghtofldhex
>    repeat with i = 1 to lenghtofldhex step 60 -- I
> want 60 chars per line
>      put  return & char i to (i+59) of fldhex after
> fldhexa2
>    end repeat
>    put empty into fldhex
>    put toUpper(fldhexa2) into fld "text"
>    --put ((the ticks - zxcv) / 60) && "seconds to
> create the hexadecimal 
> data from binary imagedata"
> ###
>    put the millisecs - zap && "milliseconds to
> create the hexadecimal 
> data from binary imagedata"
> 
> end mouseUp

Excellent! With the comments that you put in the
code, I have learned very important techniques.

> > put binaryDecode("H*", char i to i+2 of asd)after
var
> > -- produces an error!
> 
> Of course it should be :
> get binarydecode("H*", char i to i+2 of asd,v1)
> put  v1 after var	

I agree, but then, Why binaryEncode permits this
different sintax:

put binaryEncode("H*", char i to i+2 of asd)after var

After all this time crunching, I suppose that
the next step for more speed is an external. :-)

Thanks a lot, Wouter and Dar!

al

=====
Visit my site:
http://www.geocities.com/capellan2000/
Search the mail list:
http://mindlube.com/cgi-bin/search-use-rev.cgi

__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus


More information about the use-livecode mailing list