Page 1 of 1

return values

Posted: Sat Aug 26, 2006 11:08 am
by sid6.7
return values

not sure i understand them very well
is thier a tut here or a chart for doing
these calc's or a simple formula?

i've seen AND OR and such used
also....not sure what they mean...

i vaugly the notion that it also
has a postivie or negative thing too?

Re: return values

Posted: Sun Aug 27, 2006 12:55 am
by moneo
sid6.7 wrote:return values

not sure i understand them very well
is thier a tut here or a chart for doing
these calc's or a simple formula?

i've seen AND OR and such used
also....not sure what they mean...

i vaugly the notion that it also
has a postivie or negative thing too?
What do you mean by RETURN VALUES?

AND, OR, XOR and a few others are logical operators, which are work differently than arithmetic operators like + - * /.
These logical operators perform bit-wise operations on the operands.

AND: When you do:
x = a AND b
Then "x" will have a 1 bit in those bit positions where "a" has a 1 bit as well as (AND) "b" has a 1 bit in the same position.
Example: a = 6 : b = 7 : x = a AND b
The result in x will be 6
because bitwise a is 110
and b = 111
They both only have 1 bits on in the first two position, which results in
a 110 or 6.

OR:
x = a OR b
The "x" will have a 1 bit in those bit positions where either (OR) "a" or "b" has a 1 bit in the same position.
Example: a = 5 : b = 2 : x = a OR b
The result in x will be 7
because bitwise a is 101
and b = 010
Looking at both "a" and "b" bit by bit, there is at least one 1 bit in each bit position, which results in a 111 or 7.

XOR:
The XOR (Exclusive OR) is very similar to the OR, with one exception. If the same bit position of both "a" and "b" already have a 1 bit in both, then the result will be zero in that bit position.
Example: a = 5 : b = 2 : x = a XOR b
The result in x will be 7, just like the OR, because no bits were both on in the same bit position.

But, when a = 5 : b = 3 : x = a XOR b
The result in x will be 6
because bitwise a is 101
and b = 011
Notice that the least significant (last) bit of "a" and "b" are both 1 (on).
Looking at both "a" and "b" bit by bit, there is at least one 1 bit in each of the first two bit positions, but both are on in the last position, which results in 110 or 6.

Why you would need to use these logical operatiors is the subject for a tutorial.

*****

Posted: Mon Aug 28, 2006 3:52 pm
by Skyler
Do you mean

Code: Select all

RETURN 0
?

Posted: Mon Aug 28, 2006 4:15 pm
by sid6.7
no moneo answered what i was looking for.....