473,327 Members | 2,071 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,327 software developers and data experts.

Bit and Byte problem

cjw
I need to read an 'unsigned char' array and save it as a bit array
(values are only 0s or 1s). When processing, have to do math
operations such as summing up the values etc. Pl let me know an
efficient way of doing this.
cjw
Nov 13 '05 #1
4 2848
Greetings.

In article <de**************************@posting.google.com >, cjw wrote:
I need to read an 'unsigned char' array and save it as a bit array
(values are only 0s or 1s). When processing, have to do math
operations such as summing up the values etc. Pl let me know an
efficient way of doing this.


Given your e-mail address and the nature of the query, I presume this is a
homework problem. Fortunately, it's not too hard to solve if you read up
on C's bit-shifting operators (<< and >>). Once you've done so, try
writing the program, and if you need help, send another post with your code
and a description of the problem.

Regards,
Tristan

--
_
_V.-o Tristan Miller [en,(fr,de,ia)] >< Space is limited
/ |`-' -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= <> In a haiku, so it's hard
(7_\\ http://www.nothingisreal.com/ >< To finish what you
Nov 13 '05 #2
s2******@student.rmit.edu.au (cjw) wrote in message news:<de**************************@posting.google. com>...
I need to read an 'unsigned char' array and save it as a bit array
(values are only 0s or 1s). When processing, have to do math
operations such as summing up the values etc. Pl let me know an
efficient way of doing this.
cjw


What you mean by bit array !! Is it 8 bits in 1 byte you call as array
??
Well, an array is composed of bytes of type the array points to and
each
byte is composed of 8 bits. Bit values help to represent the value in
that byte to read and process them.
Define your problem or post snippet of your compilable code in order
to reply to your mail

- Ravi
Nov 13 '05 #3
ra*****@yahoo.com (Ravi Uday) wrote:
s2******@student.rmit.edu.au (cjw) wrote in message news:<de**************************@posting.google. com>...
I need to read an 'unsigned char' array and save it as a bit array
(values are only 0s or 1s). When processing, have to do math
operations such as summing up the values etc. Pl let me know an
efficient way of doing this.
cjw
What you mean by bit array !! Is it 8 bits in 1 byte you call as array
??
Well, an array is composed of bytes of type the array points to and


No.
An array is a contiguous set of objects of a particular type.
An array object doesn't point to anything, though it decays into a
pointer to its first element in value contexts.
each
byte is composed of 8 bits.
No.
A byte is /at least/ eight bits in width.
Bit values help to represent the value in
that byte to read and process them.
Value bits represent the value of an object. Padding bits don't.
Define your problem or post snippet of your compilable code in order
to reply to your mail


Seconded.
--
Irrwahn
(ir*******@freenet.de)
Nov 13 '05 #4
Irrwahn Grausewitz <ir*******@freenet.de> wrote in message news:<8b********************************@4ax.com>. ..
ra*****@yahoo.com (Ravi Uday) wrote:
s2******@student.rmit.edu.au (cjw) wrote in message news:<de**************************@posting.google. com>...
I need to read an 'unsigned char' array and save it as a bit array
(values are only 0s or 1s). When processing, have to do math
operations such as summing up the values etc. Pl let me know an
efficient way of doing this.
cjw


What you mean by bit array !! Is it 8 bits in 1 byte you call as array
??
Well, an array is composed of bytes of type the array points to and


No.
An array is a contiguous set of objects of a particular type.
An array object doesn't point to anything, though it decays into a
pointer to its first element in value contexts.

Really .. Clever !
each
byte is composed of 8 bits.


No.
A byte is /at least/ eight bits in width.
Bit values help to represent the value in
that byte to read and process them.


Value bits represent the value of an **object** oh. Padding bits don't. -> Yes i forgot about that :-)
Define your problem or post snippet of your compilable code in order
to reply to your mail


Seconded.


Mmmm..
Nov 13 '05 #5

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

Similar topics

3
by: Steve Mauldin | last post by:
I came across an example in the MSDN documentation using RC2 encryption(the link to the article is at the end of this message). When I tried it I had a problem with getting back the same length...
13
by: Ray Z | last post by:
So far, I get the idea that if I want to use both the unmanaged and managed memory, I can not avoid memory copy. But I DO need to avoid it. I get a idea that maybe I could use "union" to convert...
6
by: Ricardo Quintanilla | last post by:
i have a code that sends data to a socket listening over as400 platform, the socket responds to me as a "byte array". then i need to convert the "byte array" into a string. the problem is that...
8
by: intrepid_dw | last post by:
Hello, all. I've created a C# dll that contains, among other things, two functions dealing with byte arrays. The first is a function that returns a byte array, and the other is intended to...
5
by: rcolby | last post by:
Evening, Wondering if someone can point me in the right direction, on how I would compare a system.guid with a system.byte. system.guid (pulled from sql server table with a data type of...
5
by: jeremyje | last post by:
I'm writing some code that will convert a regular string to a byte for compression and then beable to convert that compressed string back into original form. Conceptually I have.... For...
3
by: jackmejia | last post by:
Hello I am fighting to sync a C++ client with a C# server, I have managed to create a byte array in C++ stored as char* to be sent over the network to the server written in C#. on the C# side,...
1
by: MimiMi | last post by:
I'm trying to decrypt a byte array in java that was encrypted in C#. I don't get any error messages, just a result that's completely not what I was hoping for. I think I am using the same type of...
2
by: MimiMi | last post by:
I'm trying to decrypt a byte array in java that was encrypted in C#. I don't get any error messages, just a result that's completely not what I was hoping for. I think I am using the same type of...
3
by: ist | last post by:
Hi, I am trying to get (and transfer over ASP.NET) some encrypted data from some MySQL fields. Since the data contains many unicode characters, I tried to get the data as a series of ASCII...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.