bitwise-xor Questions

4

Solved

This is more of a just for fun question. I’m working on a SC61860 CPU, which is an 8-bit CPU for a Sharp PC-1360 Pocket Computer from 1987 (also used in PC-1401 & 1403’s). Its instruction set d...

2

Solved

I try to implement efficient exclusive-or (XOR) in Prolog CLPFD. This should be simple predicate like: xor(A, B, AxorB). A, B, AxorB are natural numbers (with 0) and AxorB is a result of A xor B...
Institutionalism asked 17/5, 2014 at 21:39

2

Is it possible to simplify (a+b)xor(c+b)? What is the contribution of b to the final result? Note that I'm mixing boolean algebra with arithmetic, xor is a bitwise exclusive or on correspondi...
Chalcopyrite asked 5/3, 2014 at 15:41

3

Solved

I was reading about xor in php , and I saw this example: $aa = "A" ^ "}"; echo $aa; // < So I search in internet about how it works and they said its sum the ascii code , but the above code ...
Message asked 14/8, 2019 at 11:41

1

Solved

I came across the below code snippet in a product's code. It is using bitwise XOR for string comparison. Is this better than the String.equals(Object o) method? What is the author trying to achieve...
Ty asked 14/11, 2017 at 22:46

7

Solved

I know the working of XOR, Console.WriteLine(1^1); // returns 0 results to 00000001 00000001 -------- 00000000 but how does this return 2? Console.WriteLine(-(-1^1)); // returns 2 ...
Inclination asked 5/5, 2017 at 7:43

5

Solved

Here is the original code: public static String reverseString(String s){ if(s == null) return ""; char[] rev = s.toCharArray(); int i = 0, j = s.length() - 1; while(i < j) { rev[i] ^= re...
Bogle asked 27/10, 2016 at 3:54

2

Solved

This is a recent interview question from Google: We define f(X, Y) as number of different corresponding bits in binary representation of X and Y. For example, f(2, 7) = 2, since binary represe...
Slipper asked 7/10, 2015 at 15:35

4

Solved

Given XOR & SUM of two numbers. How to find the numbers? For example, x = a+b, y = a^b; if x,y are given, how to get a, b? And if can't, give the reason.
Kenn asked 11/9, 2013 at 3:45

2

Solved

I think I understand python bytes objects, but supporting bitwise operations on byte strings seems like such an obvious feature. I don't understand why it is not supported. >>>'abcdefg'.e...
Sheronsherourd asked 18/9, 2015 at 18:6

1

I was reading an article from other website (Computer Science - Can a Minimum Possible Efficiency be proven?) about assuming a minimum Big-O time for the worst cases. One of the answers goes to a ...
Sphenogram asked 13/1, 2015 at 12:16

10

Solved

I had been studying the algorithm for finding lonely integers in an array, and here is the implementation: int arr[] = {10, 20, 30, 5, 20, 10, 30}; int LonelyInteger = 0; for(int i=0; i< 7; i++...
Stevenage asked 4/2, 2015 at 11:39

1

I have a positive integer array- {1,5,8,2,10} and a given value 7. I need to find whether a subset of the array exists such that the XOR of its elements is the value 7. In this case the subset is {...
Jin asked 6/12, 2014 at 14:20

9

Solved

I'm new to Xor encryption, and I'm having some trouble with the following code: function xor_this($string) { // Let's define our key here $key = ('magic_key'); // Our plaintext/ciphertext $te...
Cheerly asked 25/9, 2011 at 21:13

2

I don't fully understand this algorithm of calculating the parity bit. Can someone please explain in detail? The following code is taken from the 'Hacker's Delight' book: int parity(unsigned x) {...
Romanism asked 27/6, 2013 at 18:43

3

Given an array where number of occurrences of each number is odd except one number whose number of occurrences is even. Find the number with even occurrences. e.g. 1, 1, 2, 3, 1, 2, 5, 3, 3 Out...
Stercoricolous asked 9/9, 2012 at 20:35

6

Solved

Can anyone explain this operator with a good example? I know what this operator is. I mean a real-life example.
Allisan asked 21/6, 2011 at 8:21
1

© 2022 - 2024 — McMap. All rights reserved.