Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
17
Task/Bitwise-operations/Vala/bitwise-operations.vala
Normal file
17
Task/Bitwise-operations/Vala/bitwise-operations.vala
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
void testbit(int a, int b) {
|
||||
print(@"input: a = $a, b = $b\n");
|
||||
print(@"AND: $a & $b = $(a & b)\n");
|
||||
print(@"OR: $a | $b = $(a | b)\n");
|
||||
print(@"XOR: $a ^ $b = $(a ^ b)\n");
|
||||
print(@"LSH: $a << $b = $(a << b)\n");
|
||||
print(@"RSH: $a >> $b = $(a >> b)\n");
|
||||
print(@"NOT: ~$a = $(~a)\n");
|
||||
/* there are no rotation operators in vala, but you could define your own
|
||||
function to do what is required. */
|
||||
}
|
||||
|
||||
void main() {
|
||||
int a = 255;
|
||||
int b = 2;
|
||||
testbit(a,b);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue