- Rexx Tutorial
- Rexx - Home
- Rexx - Overview
- Rexx - Environment
- Rexx - Installation
- Rexx - Installation of Plugin-Ins
- Rexx - Basic Syntax
- Rexx - Datatypes
- Rexx - Variables
- Rexx - Operators
- Rexx - Arrays
- Rexx - Loops
- Rexx - Decision Making
- Rexx - Numbers
- Rexx - Strings
- Rexx - Functions
- Rexx - Stacks
- Rexx - File I/O
- Rexx - Functions For Files
- Rexx - Subroutines
- Rexx - Built-In Functions
- Rexx - System Commands
- Rexx - XML
- Rexx - Regina
- Rexx - Parsing
- Rexx - Signals
- Rexx - Debugging
- Rexx - Error Handling
- Rexx - Object Oriented
- Rexx - Portability
- Rexx - Extended Functions
- Rexx - Instructions
- Rexx - Implementations
- Rexx - Netrexx
- Rexx - Brexx
- Rexx - Databases
- Handheld & Embedded
- Rexx - Performance
- Rexx - Best Programming Practices
- Rexx - Graphical User Interface
- Rexx - Reginald
- Rexx - Web Programming
- Rexx Useful Resources
- Rexx - Quick Guide
- Rexx - Useful Resources
- Rexx - Discussion
Rexx - Bitwise Operators
Groovy provides four bitwise operators. Below are the bitwise operators available in Groovy.
Sr.No. | Operator & Description |
---|---|
1 | bitand This is the bitwise “and” operator |
2 | bitor This is the bitwise “or” operator |
3 | bitxor This is the bitwise “xor” or Exclusive or operator |
Following is the truth table showcasing these operators −
p | q | p bitand q | p bitor q | p bitxor q |
---|---|---|---|---|
0 | 0 | 0 | 0 | 0 |
0 | 1 | 0 | 1 | 1 |
1 | 1 | 1 | 1 | 0 |
1 | 0 | 0 | 1 | 1 |
Example
The following program shows how the various operators can be used.
/* Main program */ a = 21 b = 347 Say c2b(a) Say c2b(b) Say c2b(bitand(a,b)) Say c2b(bitor(a,b)) Say c2b(bitxor(a,b)) Exit c2b: return x2b(c2x(arg(1)))
The output of the above program will be −
0011001000110001 001100110011010000110111 001100100011000000110111 001100110011010100110111 000000010000010100110111
rexx_operators.htm
Advertisements