Most voted "bitwise" questions
Binary logic, or bitwise Operation, is the basis of all computational calculus. In fact, it is these most basic operations that constitute all the power of computers. Any operation, however complex it may seem, is translated internally by the processor for these operations. If the question is not about "Bitwise", do not use this tag, even if you are using "Bitwise" in your project.
Learn more…19 questions
Sort by count of
-
13
votes4
answers1072
viewsWhat is the practical use of bitwise operators in PHP?
Operators bit by bit, used to manipulate specific bits, are somewhat unusual (not to say rare) their use in an application PHP. If we talk about escovação de bits in compiled languages, such as…
-
6
votes1
answer142
viewsIs it worth using binary operators to gain performance?
I have the following situations: if (1 & 1){} and if (1 == 1){} According to what I’ve learned, working with bitwise Operators causes a much better performance in the program, with this I came…
-
6
votes1
answer183
viewsWhy is there no "Logical XOR" in C++?
I was thinking and I came up with this question: Why is there "Bitwise OR", "Bitwise AND" and "Bitwise XOR", if in Boolean logic there is only "Logical OR" and "Logical AND". There should be the…
-
5
votes1
answer125
viewsHow to show correct name on an Enum bitwise?
I have this one marked as [Flag], ie, are values in bit [Flags] public enum Position { None, Left, Right, Both=3 } Setei to Both(both) position in 3 why if it is Left and Right at the same time, it…
-
5
votes3
answers557
viewsConvert "unsigned int" to "unsigned char" vector?
I need to convert a unsigned int in a vector of unsigned char to later translate this address into binary, for a work that needs to simulate a virtual memory. Can someone explain to me how to do…
-
5
votes2
answers111
viewsCombining column value with Mysql
I am working on a report in Mysql where I need to show a percentage of several events that occurred with a group of entities. The structure of my table is as follows: | id | eventoA | eventoB |…
-
4
votes2
answers2453
viewsIs it possible to do multiplications only with operators &, |, + and -?
I have to create a program with the Assembly language K & S Model 2 that multiplies one number by another, the problem is that this language does not provide a multiplication operation. So I…
-
4
votes1
answer898
viewsHow do bit operators work?
I have the following code: volatile long Hex_To_int(long Hex , char bits) { long Hex_2_int; char byte; Hex_2_int = 0 ; for(byte = 0 ; byte < bits ; byte++) { if(Hex& (0x0001 << byte))…
-
4
votes1
answer112
viewsLogic of these bit-by-bit operations
It’s been a long time since I wanted to start in the world of emulators, I decided to stop trying to make an emulator of a complex system and start with a very basic one, a CHIP-8 emulator, which is…
-
2
votes1
answer77
viewsExtract data with bitshift and bitwise operators
Good, I’m having some trouble separating the date parts through bitwise operations. date format: yyyy-dd-mm int menor_data(int date1, int date2) { int day1 = (date1 >> 8) & 0xff; int…
-
2
votes1
answer45
viewsHelps with understanding cellular automaton code
I would like you to help me understand a code for calculating and presenting cellular automata that I found on the Internet. The code in question is as follows:: #include <stdio.h> #include…
-
1
votes2
answers102
viewsCreate sets for 16-bit variable composed of two 8-bit
I wonder if there is any way to create a define for a "variable" in C that has 16 bits called PORTAB, so that writing: PORTAB = 0xAAFF; is equivalent to: PORTA = 0xAA; PORTB = 0xFF; Thank you.…
-
1
votes0
answers57
viewsWhat is the use of bitwise shift operators?
Recently I discovered the bitwise shift operators << and >>. I know these operators move bits left and right, but what’s the use of doing this ? In which cases these shift operators are…
-
0
votes1
answer48
viewsHow to calculate the first 4 bytes of an Address ex: 00F28758
I wish I could figure out how to calculate the 4 bytes of a address and then use a ReadProcessMemory. I just wanted to figure out how to calculate this because every time I try it goes wrong. Let’s…
-
0
votes2
answers63
viewsOperator Bitwise Right
Hello Conducting some studies on PHP I came across bitwise and until then all its operations has not been anything difficult, just the one of the right shift An exmeplo I took and I still don’t…
-
0
votes0
answers25
viewsXOR operator in if
Hello, What is the meaning/result of the operator in the following if? char ch, str[32]; if(str[inf - 1] == ch ^ str[sup -1] == ch) counter++; I know that the goal is only one of the conditions is…
-
0
votes1
answer54
viewsPython bitwise operator output
Why the value of ~True is -2 and that of ~False is -1? The logical operator equivalent not, in not True, results in False and vice versa.…
-
0
votes0
answers60
viewsC++ - Set and remove specific bits from a single
I am developing a Gameboy emulator and one of the tasks is to set the flags after each instruction: ... //Representa pares de registradores do gameboy union RegPair { std::uint16_t reg; struct pair…
-
-3
votes2
answers323
viewsHow to isolate higher order bits and lower order bits in C/C++?
I need to create two functions One receives an integer value and returns another one containing only the 8 bits of the lowest order of the original value, with the remaining bits set to zero. The…