Subject:
|
Re: bitwise manipulations in C
|
Newsgroups:
|
lugnet.robotics
|
Date:
|
Fri, 6 Aug 2004 22:08:21 GMT
|
Original-From:
|
Steve Baker <sjbaker1@airmail*NoSpam*.net>
|
Viewed:
|
944 times
|
| |
| |
scott davis wrote:
> Can anybody tell me about bitwise manipulations or point me to a site
> that explains what it is,
There really isn't a lot to tell.
All integers (short's, chars) in C are considered as a bunch of bits.
You can use the '&', '|', '^', '~', '<<' and '>>' operators to AND,
OR, XOR, INVERT, Up-shift and Down-shift all of the bits at once.
> what its used for,
All sorts of things - you might have a lot of single bit variables
that you'd like to pack together into a single integer - or you might
be working with graphics and have 16 bit colours comprised of 5 bits of
Red, 6 bits of Green and 5 bits of blue packed into a single 16 bit number.
There is no one particular use.
> and how to use it?
Those bitwise operators work just like any other integer math operator,
it's just arithmetic.
---------------------------- Steve Baker -------------------------
HomeEmail: <sjbaker1@airmail.net> WorkEmail: <sjbaker@link.com>
HomePage : http://www.sjbaker.org
Projects : http://plib.sf.net http://tuxaqfh.sf.net
http://tuxkart.sf.net http://prettypoly.sf.net
-----BEGIN GEEK CODE BLOCK-----
GCS d-- s:+ a+ C++++$ UL+++$ P--- L++++$ E--- W+++ N o+ K? w--- !O M-
V-- PS++ PE- Y-- PGP-- t+ 5 X R+++ tv b++ DI++ D G+ e++ h--(-) r+++ y++++
-----END GEEK CODE BLOCK-----
|
|
Message is in Reply To:
| | bitwise manipulations in C
|
| Hi, Can anybody tell me about bitwise manipulations or point me to a site that explains what it is, what its used for, and how to use it? thanks, Scott ___...___ Express yourself instantly with MSN Messenger! Download today - it's FREE! (URL) (20 years ago, 6-Aug-04, to lugnet.robotics)
|
3 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
Active threads in Robotics
|
|
|
|