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 > Bit ****fting p...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 8 Topic 24872 of 27671
Post > Topic >>

Bit ****fting problem with endieness

by Madhur <madhurrajn@[EMAIL PROTECTED] > Mar 10, 2008 at 05:21 AM

I am having the following problem of bit ****fting.

My program runs on a little endian machine. Consider that if I have
the following data represented in big endian...

0x12345678

the little endian representation would be

0x78563412.

Now if I wan to ****ft my original data by 4 bits to 0x01234567, then
my approach would be

val = 0x12345678
htonl(htonl(val)>>4)

and result represented in my machine is

0x67452301.

This looks quite redundant to convert little endian to Bid Endian
****ft it and then convert back. Basically I thinking of how to get rid
of those two htonl system calls.

I would like to know is there any better way to do this. A best
possibility to ****ft in little endian mode??
 




 8 Posts in Topic:
Bit Shifting problem with endieness
Madhur <madhurrajn@[EM  2008-03-10 05:21:19 
Re: Bit Shifting problem with endieness
"Joachim Schmitz&quo  2008-03-10 13:35:03 
Re: Bit Shifting problem with endieness
rlb@[EMAIL PROTECTED] (R  2008-03-10 12:44:32 
Re: Bit Shifting problem with endieness
Madhur <madhurrajn@[EM  2008-03-10 05:48:17 
Re: Bit Shifting problem with endieness
Thad Smith <ThadSmith@  2008-03-10 07:44:00 
Re: Bit Shifting problem with endieness
Philip Potter <pgp@[EM  2008-03-10 14:19:39 
Re: Bit Shifting problem with endieness
"Bartc" <bc@  2008-03-10 18:18:44 
Re: Bit Shifting problem with endieness
Kenneth Brody <kenbrod  2008-03-10 13:08:12 

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 Oct 11 8:25:19 CDT 2008.