Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Bit handling

Posted on 1998-07-21
2
192 Views
Last Modified: 2010-04-10
I have just learned how to turn bits on and off in c++.  I know that a byte (8 bits) is numbered from 1,2,4,8,16,32,64.  My computer is a 32-bit machine and i was wondering how i was able to access the 64 bit?  In addition, i know that an integer carries 4 bytes on my machine - does this mean that there are four rows that i can turn bits on or off?
0
Comment
Question by:karthy
2 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 1168246
if( byte & 64 ){ cout << "64 bit is set" << endl; }
//a four byte (unsigned) int has 32 bits, 1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432,67108864,134217728,268435456,536870912,1073741824,2147483648





0
 
LVL 23

Accepted Solution

by:
chensu earned 50 total points
ID: 1168247
To access 64-bit, use a unsigned char array containing 8 bytes. Some compilers may have extension. Microsoft Visual C++ has a data type __int64.

An integer (int) carries 4 bytes, which means you have 32-bit. Of course, you can consider it as four rows each of which contains 8-bit.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question