Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Improved bAND, bOR, bXOR
#3
I can't offhand see how this code could be optimised further, honestly. I'd be curious and intrigued to see what clever tricks could be pulled, though.


Boriel Wrote:This code is already implemented in the library-asm directory (see neg32.asm).

Oh wait, you're just talking abot NOT?

I had a look at that. That's a two's complement negation, which isn't quite the same - it adds 1 :-) But yes, it does it exactly the same way. I
In fact come to think of it:

Code:
FUNCTION bNOT32 (a as long) as long
return (-a)+1
END FUNCTION

ought to call your code and do the same thing, yes? The downside is it has to deal with long, not uLong - and usually programmers playing with bitwise operations want unsigned integers so they can just think of them as bits, not values.


[and referring to and/or/not]
I know you planned to put them in as full fledged operators, with bAND == &, but I revisited this as a temporary measure because

1> I hated the original ones I did - they were a kludge using fastcall, because I hadn't worked out how to do stdcall at all. (And I'm still not sure I'm doing it right)

2> I got the feeling there was a need for them (read as: I needed them, and thought I should share) until they were put into the main code; which I thought might be a while.

So, at least until something better comes along, I figured these wouldn't be bad.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)