Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Bitwise Operators in Scripts?

This may be very basic, but I can't seem to find bitwise operators in Scripts.

My input includes an integer that is a collection of set bits. I wish to do bitwise operations on this integer to pick out specific bits that are set.

How can I do this?

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Hi,

This is what help says:

"

Bit Operators

All bit operators convert the operands to signed integers (32 bit) and return the result in the same way. All operations are performed bit by bit.

bitnot Bit inverse. Unary operator. The operation returns the logical inverse of the operand performed bit by bit.
bitand Bit and. The operation returns the logical AND of the operands performed bit by bit.
bitor Bit or. The operation returns the logical OR of the operands performed bit by bit.
bitxor Bit exclusive or. The operation returns the logical exclusive or of the operands performed bit by bit.
>> Bit right shift. Unary operator. The operation returns the operand shifted one step to the right.
<< Bit left shift. Unary operator. The operation returns the operand shifted one step to the left.

"

Does this help?

Regards,  tresesco

View solution in original post

4 Replies
tresesco
MVP
MVP

Hi,

This is what help says:

"

Bit Operators

All bit operators convert the operands to signed integers (32 bit) and return the result in the same way. All operations are performed bit by bit.

bitnot Bit inverse. Unary operator. The operation returns the logical inverse of the operand performed bit by bit.
bitand Bit and. The operation returns the logical AND of the operands performed bit by bit.
bitor Bit or. The operation returns the logical OR of the operands performed bit by bit.
bitxor Bit exclusive or. The operation returns the logical exclusive or of the operands performed bit by bit.
>> Bit right shift. Unary operator. The operation returns the operand shifted one step to the right.
<< Bit left shift. Unary operator. The operation returns the operand shifted one step to the left.

"

Does this help?

Regards,  tresesco

upendrarajeshir
Contributor II
Contributor II

Hi Tresesco,

Can you give any example, this would really help me...

Thank & Regards,

Upendra

swuehl
MVP
MVP

Please check

http://en.wikipedia.org/wiki/Bitwise_operation

So one simple example in a textbox:

= 10 bitand 3

results in 2

upendrarajeshir
Contributor II
Contributor II

Hey swuehl,

Thanks for the reply, it helps me a lot.

Thanks & Regards