Re: Need XOR solution
Re: Need XOR solution
- Subject: Re: Need XOR solution
- From: has <email@hidden>
- Date: Wed, 7 Aug 2002 19:54:46 +0100
Arthur J. Knapp wrote:
>
>> on Bitify(n)
>
Yes, the Bitify handler is nice and simple. I keep meaning to properly
>
speed-test it against repeat loops for doing the same thing.
I imagine it's faster: loops in AS never seem terribly fast to me (or maybe
this is just because I'm old and bitter, and my Mac even more so). OTOH,
using a loop would make for neater, more elegant code; it'd also make it
easy to code an algorithm that could handle any word length. In the end,
you tradeoff for whichever better suits your circumstances [if you're
working with 8-bit words and need the speed, use the posted version; if you
need total flexibility, use a loop; if you need flexibility on word length
but still hanker for speed and don't mind pig-ugly, totally unreadable
code, use a partially unrolled loop that combines the two approaches].
BTW, Arthur, you might like to check out the ESG MathLib for its bitwise
functions (if you're into this stuff):
http://www.esglabs.com/snippets/mathlib.sit.hqx
(Looks like a great maths library, though needs a very minor tweak or two
to work cleanly outside of FaceSpan due to their use of FS's null constant.)
>
One thing
>
that may confuse some people is the text item delimiters situation.
>
Bascially, I perform a save and restore in the main handler, CharXOR(),
>
so that each AsciiNumber_t() handler doesn't have to, (the "_t" is a
>
warning that the handler sets the tids but makes no attempt to restore
>
them).
You bin burnin' users with this pedal-to-the-metal stuff, eh? You old
rogue, you... ;)
>
> One thing I definitely don't understand at this point is why you use the
>
> "my" preceeding the handler calls. I tried the script with all the
>
> "my"s removed and got the same results. Aren't handler calls always
>
> processed at the script level unless they're in a tell block?
>
>
Yes, sorry. :)
>
>
Recently, I have been deeply involved in a project involving script
>
objects with inherited properties and handlers, and I've gotten to the
>
point where I type the word "my" in my sleep. ;-)
Calling inherited handlers doesn't require the 'my' keyword; only accessing
inherited properties. Where you do need it is when calling a local handler
from within a tell block pointed at some other object (otherwise your call
shoots off to that object instead). [Just to clarify for anyone who might
be wondering.]
(BTW, I have visions here of AJK typing in his sleep, waking up the next
morning and his script's all done. Sorta like the scene in Dumb and Dumber
where they're driving overnight. I tell you, this man is talent
personified...:)
has
--
(My email address has changed from <email@hidden> to
<email@hidden>. Please update your address books accordingly.)
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.