Category "bitwise-operators"

What does this char string related piece of C++ code do?

bool check(const char *text) { char c; while (c = *text++) { if ((c & 0x80) && ((*text) & 0x80)) { return true;

Copy bits in correct order

In order to parse a binary stream of unmanaged data, I have to recreate data types. The data is compressed which means I read 2 bytes which actually represent a

How do I use Java's bitwise operators in Kotlin?

Java has binary-or | and binary-and & operators: int a = 5 | 10; int b = 5 & 10; They do not seem to work in Kotlin: val a = 5 | 10; val b = 5 &

When bitwise and & operation is greater or equal to bitwise xor ^ operation?

When bitwise & operation is greater or equal to bitwise ^ operation? For example, 4&7 >= 4^7 is true. How do we know when it will be true? The one wa

Number of trailing zeroes

I've written a function trailing_zeroes(int n) that returns the number of the trailing zeroes in the binary representation of a number. Example: 4 in binary is

Go << and >> operators

Could someone please explain to me the usage of << and >> in Go? I guess it is similar to some other languages.