Skip to main content

Timeline for Reversed Binary Numbers

Current License: CC BY-SA 3.0

10 events
when toggle format what by license comment
Jan 6, 2015 at 16:26 comment added rolfl The answer to that, @Edward, heavily depends on what you expect as output to 1, similarly 2. I guess there are uncertainties in the question... it's not well specified.
Jan 6, 2015 at 16:24 history edited rolfl CC BY-SA 3.0
make int -> long
Jan 6, 2015 at 16:23 comment added Edward It's not clear to me that 3 is the correct response to input 6.
Jan 6, 2015 at 16:21 comment added rolfl @Edward: From ideone: In 6 out 3
Jan 6, 2015 at 16:19 comment added Edward What happens when you input 6?
Jan 6, 2015 at 16:18 comment added Edward I'd suggest two changes: 1) make all of the numbers unsigned rather than int and 2) use a for loop instead of a while loop as: for (result=0;value;value>>=1)
Jan 6, 2015 at 16:03 history edited rolfl CC BY-SA 3.0
Add ideone link
Jan 6, 2015 at 15:58 comment added rolfl @user3629249 - works fine for me: ideone.com/J4jK61
Jan 6, 2015 at 15:55 comment added user3629249 this fails when there are leading 0 bits in the input value
Jan 6, 2015 at 15:44 history answered rolfl CC BY-SA 3.0