Converting Hexadecimal in Binary
Alejandro Tejada
capellan2000 at yahoo.com
Sun Jan 11 04:26:43 EST 2004
on Sat Jan 10
Dar Scott wrote:
>You can move toUpper() out of the loop.
You are right. The time dropped from 1.05 seconds
to 0.9
>It might help to avoid the "if", they seem to
>take a long time. I don't know if avoiding that
>is worth the trouble, though. One way to
>to make the hex string and then break it up aftwards.
Amazing! This make the time drop from 0.9
to 0.7 seconds.
This is the handler:
local v1
on mouseUp
put the ticks into zxcv
-- 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 1 into asd
delete char 1 of asd
-- the first char of the imagedata is the alphadata
or maskdata
repeat with i = 1 to length(asd) step 4
get binaryDecode("H*", char i to i+2 of asd, v1)
put 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 "hex"
put ((the ticks - zxcv) / 60) && "seconds to create
the hexadecimal data from binary imagedata"
end mouseUp
But still, i feel curious to know WHY binaryencode()
could put his results after a variable and
binarydecode
reports an error. The sintax of both functions is
similar so, Where did originates this error?
put binaryDecode("H*", char i to i+2 of asd)after var
-- produces an error!
put binaryEncode("H*", char i to i+2 of asd)after var
-- works perfectly!
Thanks again Dar, for your extraordinary help
with this task.
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