473,396 Members | 2,039 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.

Splitting large datas into smaller pieces

2
How might one go about breaking a 64 bit variable into ever smaller chunks of data? First eight 1 byte variables, from there sixteen 1 nibble variables, down to bits. Is it even possible? A pointer to char sized portions of the 64 bits? What after that?

I am new to programming in general, and very curious.
Jul 24 '09 #1
2 1560
Banfa
9,065 Expert Mod 8TB
A char pointer given the same address in memory as a 64 bit int will point to the first char in memory that makes up the 64 bit variable (assuming such a conversion is valid for the platform you are working on).

However that byte will not be the same byte of the 64 bit variable on all platforms, for instance on little endian platforms it will be the least significant byte of the 64 bit int and on big endian platforms it will be the most significant byte.

To single bytes out of multi-byte integers in a platform independent way you need to you the bitwise shift, and and or operators.

You can then use the same operators to single out nibbles and bits in the variable.

Look up these operators in our C++ reference

<<
>>
&
|
^
~
Jul 24 '09 #2
Nexus6
2
Thanks for the information.
Jul 24 '09 #3

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

Similar topics

3
by: Michael | last post by:
Does anyone have any ideas about how I can go about this faster. I have a large form that is being submitted, and from that a new row in a database will be created. I'm working on the page that...
3
by: William Ahern | last post by:
I'm looking for resources on splitting and merging XML trees. Specifically, on methods to pare large XML documents into smaller documents which can be merged later. Off of the top of my head, I...
11
by: CSN | last post by:
Is it possible to iterate over an array in plpgsql? Something like: function insert_stuff (rel_ids int) .... foreach rel_ids as id insert into table (rel_id, val) values (id, 5);
0
by: Sam Carleton | last post by:
I am looking for advice on best practices. I am coding against a digital camera SDK. One of the callback functions returns the large, multi megabyte images in smaller chunks. Some of the images...
1
by: Kevin A. | last post by:
Hi all, I'm trying to make a little game in VB.NET that uses sprites (bitmaps) with a fixed size, currently 32x32 pixels. Now I was thinking: when I want to include objects in my game...
2
by: Jenny | last post by:
Hello All! I have a long XML file that I should transmit to other computer using http. Problem is that the whole XML Document is too large for one transmitting. What is the nicest way to...
2
by: Jenny | last post by:
Hello All! I have a long XML file that I should transmit to other computer using http. Problem is that the whole XML Document is too large for one transmitting. What is the nicest way to...
4
by: nikila | last post by:
Hi, I am trying to split large xml files to smaller xml files using c#.net. can you please provide any sample code for this? I have to split the file if the size is more than 10 MB. Also, xml...
6
by: bleen | last post by:
can someone point me in the right direction here.. I have a script (essentially a giant for loop) that takes about 20 mins to run on my server. I want "split" this process onto a second server...
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
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.