473,396 Members | 1,827 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,396 software developers and data experts.

Bit manipultion

Hi, Im new to C# and have been assigned a project that involves creating part of an Mpeg2 Packet in C#.
The problem I have is when it comes to bit manipulation and or byte manipulation in order to create the packets. I tried using bitarrays in order to create the packets and am running into problems, especially when I have to convert integer values and put them into specific locations of a given bit array. Also the bit array follows in little endian lsbl.
Everytime I convert an integer I get invalid values...
ex:
int ivalue = 1028;

byte[] myByteArray = System.BitConverter.GetBytes(ivalue);
BitArray news = new BitArray(myByteArray);

the BitArray becomes much larger than I need it to be, I want it to be within 10 bits.

Is there any example on how to create a bit packet?
Am I going about this the right way by using bitarrays? or should I be manipulating Bytes?

My problem with bytes is that, I cannot edit individual bits easilly.

Please Help

Kp
Jan 13 '10 #1
0 1205

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: DKM | last post by:
Here are the source code files to a Java applet that utilizes LiveConnect to communicate with Javascript, and the HTML file. The thing works both in IE 6.0 and FireFox 1.4. but with some...
0
by: Earl Teigrob | last post by:
I am currently using native .net XML classes for managing my little key/value data storage requirements and they work great. I have created a simple class to abstract the XML and manage my...
1
by: help1267 | last post by:
Hi, Can somebody provide me with an example on how one can transfer data from one class to another ? I have one class 'processing' information that I then want to update into the "master_data"...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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...

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.