Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Bit Shifting question  RSS feed

 
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, thank you for reading

i have a question which deal with bit shifting


x=1 ==> 0000 0000 0000 0000 0000 0000 0000 0001

my question is, let say right shift x to 31 bits, will the bit shift after the rightmost bit and then will continue the shift from leftmost ?

after right shift to 31 bits, would it be 0000 0000 0000 0000 0000 0000 0000 0010 ?
 
Ranch Hand
Posts: 1272
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

my question is, let say right shift x to 31 bits, will the bit shift after the rightmost bit and then will continue the shift from leftmost ?


You are describing a right circular shift. Java does not do this. Bits shifted past the end of a word go into the bit bucket, where they will be reused the next time you reboot your computer.
 
Alvin chew
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mike, thanks for answering , based on


can you please clarify further details? what do you means bit bucket ? and how could it be reuse during enxt time reboot the computer ?
 
author
Sheriff
Posts: 23588
138
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Alvin chew:
can you please clarify further details? what do you means bit bucket ? and how could it be reuse during enxt time reboot the computer ?



Alvin,

A "bit bucket" is slang for thrown away. A.K.A. "/dev/null", "round file", "trash can", etc...

Mike,

Maybe you should add a ... You never know when jokes may be taken seriously.

Henry
 
Alvin chew
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry for misunderstanding
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!