Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ Moderated > Re: Hexadecimal...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 9 of 11 Topic 9522 of 9831
Post > Topic >>

Re: Hexadecimal and bitwise operations

by "Hakusa@[EMAIL PROTECTED] " <Hakusa@[EMAIL PROTECTED] > Apr 20, 2008 at 04:13 PM

The problem has been solved. Thanks everyone who's responded. The
function I wrote is the following:

unsigned int getHexDigit( unsigned int hex, unsigned short
digitWanted )
{
    // Tricky calculation, but it basically creates a mask (0xf) and
****fts it
    // over until it's at the desired digit (keeping in mind the size
of an int
    // is 4). Then, the resault is ****fted back to the ones place.
    // The digit wanted is subtracted by 1 because the one's place is
    // already where it's at.
    return (  hex & 0xf << (digitWanted-1) * 4  ) >> (digitWanted-1) *
4;
}

I know you guys might not need the commenting, but I consider that
part of the function so...

-- 
      [ See http://www.gotw.ca/resources/clcm.htm
for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]
 




 11 Posts in Topic:
Hexadecimal and bitwise operations
"Hakusa@[EMAIL PROTE  2008-04-19 02:01:53 
Re: Hexadecimal and bitwise operations
Alberto Ganesh Barbati &l  2008-04-19 18:09:27 
Re: Hexadecimal and bitwise operations
Pavel Minaev <int19h@[  2008-04-19 18:13:49 
Re: Hexadecimal and bitwise operations
=?UTF-8?B?QmrDtnJu?= Hend  2008-04-19 18:14:09 
Re: Hexadecimal and bitwise operations
Goedson Paixao <goedso  2008-04-19 18:14:55 
Re: Hexadecimal and bitwise operations
Brendan <catphive@[EMA  2008-04-19 18:13:28 
Re: Hexadecimal and bitwise operations
"Ivan Vecerina"  2008-04-19 18:17:19 
Re: Hexadecimal and bitwise operations
Michael.Boehnisch@[EMAIL   2008-04-19 18:15:12 
Re: Hexadecimal and bitwise operations
"Hakusa@[EMAIL PROTE  2008-04-20 16:13:16 
Re: Hexadecimal and bitwise operations
MiB <Michael.Boehnisch  2008-04-20 21:02:20 
Re: Hexadecimal and bitwise operations
Jonathan Thornburg <cl  2008-04-25 03:46:08 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Jul 26 2:52:19 CDT 2008.