Bitwise XOR

Question: Write a function 'xor' in C that takes in two q objects (both integers), performs the bitwise XOR between them and returns the result integer as a q object. This function should be exportable to q.

More Information:

https://en.wikipedia.org/wiki/Bitwise_operation#XOR

Example

                                
                                q).q.xor:`xor 2: (`xor;2); 
q)3 xor 3 
0 
q)3 xor 4 
7 
// Find the duplicate 
q)xor/[1 2 2 3] 
2
                                
                            

Solution

Tags:
c
Searchable Tags
algorithms api architecture asynchronous c csv data structures dictionaries disk feedhandler finance functions ingestion ipc iterators machine learning math multithreading optimizations realtime shared library sql statistics streaming strings tables temporal utility websockets