473,403 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Bitwise - Capture bits shifted out

I have a 32 bit number "3515261219" that really contains four 8 bit
numbers.

11010001 10000110 10100001 00100011

Is there a way to capture the bits that are shifted out of the number
when you right shift? If I can grab the bits this way I can right shift
8 bits and capture each number.

The other way I possibly see doing this is to right shift 24 which will
give the first number. Than left shift the original number 8 and than
right shift 24 and repeat. This would keep cycling each 8 bit number
to the left so that a 24 bit shift to the right would capture it.

Thoughts?
Amy.

Dec 27 '06 #1
0 1172

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: HLong | last post by:
I am trying to understand an example where the Least Significant Bit is replaced. The code is in C# and I am having problems with a line that reads: B= (byte) (Value == 1 ? B | (1 << poss) : B & ~...
7
by: Johnathan Doe | last post by:
I am trying to do some bit fiddling with unsigned chars. Don't ask me why I am doing this, I don't know. It's just an exercise. :) Here's what I am trying to do: I have one unsigned char of a...
2
by: joshc | last post by:
I have a question about the following: 4. The result of E1 << E2 is E1 left-shifted E2 bit positions: vacated bits are filled with zeros. ... If E1 has a signed type and a nonnegative value, and...
2
by: Steve Summit | last post by:
-----BEGIN PGP SIGNED MESSAGE----- It's often explained that the reason for some of the imprecision in C's definition is so that C can be implemented on different kinds of machines -- say, those...
6
by: gilad | last post by:
I am trying to return 8 bytes (64 bits) as a 'long' from a file my program is reading. The logic I am using is below: return (long)( ((inBytes & 255) << 56) | ((inBytes & 255) << 48) |...
4
by: HARDCORECODER | last post by:
ok I want to extract the first 4 bits of a 32 bit interger. The SIZE doesn't really matter. 8,16, 0r 32. I want the first 4 bits.....bit 0,1,2 and,3. I want to exract these and place into another...
6
by: jawilson2 | last post by:
Hello, I have some data that stores two 16-bit integers in a 32-bit float, and I would like to extract the data. I want to do something like ...
5
by: noridotjabi | last post by:
I'm learning to program in C and any tutorial or book that I read likes to briefly touch on birdies operators and then move on without giving any sort of example application of them. Call me what...
5
by: Gigs_ | last post by:
Can someone explain me bitwise expression? few examples for every expression will be nice x << y Left shift x >y Right shift x & y Bitwise AND x | y Bitwise OR x ^ y Bitwise XOR (exclusive...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.