On Oct 12, 5:02 pm, ankur aggarwal <ankur.mast....@gmail.com> wrote: > *You are given a integer and you want to rotate the bits of the number by a > value x. Consider the right rotation by x means the least significant x bits > should go out from left and take the position of most significant x bits.*
Might be a late response : unsigned long RotateLeft(unsigned long n,unsigned long i) { return (n << i)|(n >> (32 - i)); } unsigned long RotateRight(unsigned long n,unsigned long i) { return (n >> i)|(n << (32 - i)); } Simple & easy !! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/algogeeks -~----------~----~----~----~------~----~------~--~---