This is what I have to code. Input an array of numbers(any numbers that user inputs from standard input, aka keyboard), remove numbers from array that are not 0 and 1. Thay array should now be bitwise moved with << or >> (again user choses the number of spaces moved and a type of move). After all of that turn that array into a binary number. Max number of elements is defined as a header with #define max_num_el 255. I have issues with part of code that need me to move elements of array and turning an array into binary … |
+0 forum
4 | ||

Hi there, I have an array of unsigned chars that hold hex values, I’m interested in values [5] and [6] of the array. Say [5] = 0x5b = 0101 1011 and [6] = 0x7b = 0111 1011 I'm trying to get all of [5] and the first half of [6], so 1011011 1111. So far I’ve come up with this; short int holder = 0; memcpy(holder,&char_array[5], 2 ); short int alt = holder >> 4; return 0; I've tried creating a 14 bit data type to hold the bits, copying the 2 bytes in then shifting right 4 but this … |
+0 forum
1 | ||

These two functions compute the orders of the lowest bit and the highest bit set in the binary representation of an integer. I expect them to handle securely very large integer values. |
+1 forum
3 | ||

Hi The following code shows good enough how to multiply two long data [CODE]long x = 10, y = 3; long p = 0; while (y > 0) { if ((y & 01) != 0) p += x; x <<= 1; y >>= 1; } std::cout << "\nResult : " << p;[/CODE] But I want to make huge integers containing more than 32bit I use an array of unsigned integers, but somehow this doesnt work Note that DIGITS are defined as 20 [CODE]class Unfinitebits { unsigned int m_DATA[DIGITS]; // ... operator overloading and stuff }; Unfinitebits& Unfinitebits::operator*=(unsigned int value) { … |
+0 forum
7 | ||

What are the possible uses of the bitwise operators. i.e. bitwise AND, bitwise OR, bitwise XOR, shift right, shift left and complement. Also, what are the applications of bitwise operators in everyday problem solving. Examples would be nice. Thanks in advance |
+0 forum
12 | ||

Hi, I'm working on an assignment where we have to have a client and server sending each other an integer that represents a noughts and crosses board. I had it working by simply sending back and forth the entire NoughtsAndCrosses class, but now we need to do it just using the integers in the GameData struct using the individual bits. This is where I've gotten lost, here is my code, I'm not looking for straight up answers since I need to learn for myself, maybe just some hints to nudge me in the right direction? I think there is a … |
+0 forum
1 | ||

I'm doing some homework for a computer systems class and all is well except this one problem that I can't seem to find a solution to due to the limitations. The problem requires me to write a function that performs addition on 32-bit signed integers but saturates the result to -21474... when there would be underflow, and 21474... when there would be overflow. The limitations are it can only be written with bitwise operations, addition, and subtraction(meaning no control statements, functions, macros, division, multiplication, modulus, comparisons, casting, and no resources from libraries). I have attempted to write this several times … |
+0 forum
4 | ||

Hello ppl, I have recently started C# and while going through initial pages of bitwise operators 1 doubt came into mind. v know dat int is of 32 bits in C#. Suppose i take a number and assign some value to it and then after left shifting it by 32,the number doesn't get changed. If i do left shift 33 times the number gets multiplied by 2. However Left shifting by 31 and then left shifting it by 1 after that will make the number 0. What is actually happening....plz help to my surprise same 16 left shifting in C(as … |
+0 forum
5 | ||

Hopefully someone searches this one day and it becomes useful. I never found anything. Below is the vb syntax for combining numbers in the same memory address. [code] Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim LngWord As Long = LngMakeWord(Integer.MaxValue, 65489) Dim LoLng As Integer = LngLoWord(LngWord) Dim HiLng As Integer = LngHiWord(LngWord) Dim IntWord As Integer = IntMakeWord(6536, 25548) Dim IntLo As Short = IntLoWord(IntWord) Dim IntHi As Short = IntHiWord(IntWord) End Sub Private Function IntMakeWord(ByVal loWord As Short, ByVal hiWord As Short) As Integer Return (CInt(hiWord) << 16) Or (CInt(loWord) And Short.MaxValue) … |
+2 forum
1 |

The End.