|
Members in Shoutbox
None.
Shoutbox Search
Shoutbox Commands
/w [name] > Whisper
/r > Reply to last whisper /me > Marks as action Shoutbox Information
Moderators may delete any and all shouts at will.
|
Global Shoutbox
Please log in to shout.
[2014-10-21. : 6:33 am] O)FaRTy1billion[MM] -- l)ark_ssj9kevinl)ark_ssj9kevin shouted: if this is unsigned you can do ~0U to get all 1's, regardless of what size integer it is I just use -1./[2014-10-21. : 5:03 am] poiuy_qwert -- thats the thing, the question is wrong. its should be getSecondNibbleFromLR[2014-10-21. : 5:02 am] Dem0n -- if a short byte is only 2 bytes, how does shifting the bits by 12 work?[2014-10-21. : 4:59 am] poiuy_qwert -- it depends on the size of the variable thats storing that number[2014-10-21. : 4:57 am] Dem0n -- if you had like 0x1f, would that be represented as 0000000000011111>[2014-10-21. : 4:53 am] poiuy_qwert -- ((0000111100000000 << 4) >> 12) == (1111000000000000 >> 12) == 0000000000001111[2014-10-21. : 4:47 am] Dem0n -- Unless I don't actually get my it's being shifted to the left 4, in which case I would definitely not know why it's shifted to the right 12 times[2014-10-21. : 4:46 am] Dem0n -- I get why you shift it to the left 4 bits, but I don't understand what shifting it to the right 12 bits accomplishes[2014-10-21. : 4:36 am] NudeRaider -- jj, just create the username of what you want to quote - problem solved. ![]() [2014-10-21. : 4:33 am] jjf28 -- don't see it in the documentation... ferror might be set (conditions for ferror? can't find them)[2014-10-21. : 4:29 am] Dem0n -- if you input an int and a double, but scanf is expecting two ints, will it return 1, 2, or will there be an error?[2014-10-21. : 4:23 am] jjf28 -- I want candy... tempted to be that creepy 20yr old out trick 'or' treating without a kid ![]() [2014-10-21. : 4:08 am] Dem0n -- I was like why would you AND it by 1 because if you're rotating from the left you'll just get 00000000 lul[2014-10-21. : 4:07 am] poiuy_qwert -- and as farty was saying, if you need to do it to the left, you need to grab the leftmost bit, which would be (a & 128)[2014-10-21. : 4:01 am] poiuy_qwert -- since its shifting to the right, its grabbing the rightmost bit since it will be dropped[2014-10-21. : 4:00 am] Dem0n -- poiuy_qwertpoiuy_qwert shouted: so for correctness: ((a & 1) << 7) | (a >> 1) What does ANDing a by 1 do?[2014-10-21. : 4:00 am] l)ark_ssj9kevin -- i remember rotating bits was an exercise in k&r, it was kinda fun[2014-10-21. : 3:55 am] Dem0n -- well I mean I was just writing 11000010 and then dropping those 1's when I shifted it, which obviously isn't correct[2014-10-21. : 3:51 am] jjf28 -- you can go without, good habit to write them in if others see your work though[2014-10-21. : 3:49 am] l)ark_ssj9kevin -- if this is unsigned you can do ~0U to get all 1's, regardless of what size integer it is[2014-10-21. : 3:32 am] O)FaRTy1billion[MM] -- hey why doesn't C have an easy way to rotate bits? I never thought about that[2014-10-21. : 3:31 am] jjf28 -- i like poiuy's, if you can remember it pretty much just takes the same algorithm into 1 line (and the numbers he used are for 8-bit numbers)[2014-10-21. : 3:23 am] jjf28 -- so in the most basic terms: you shift 1 bit at a time, if the bit you're about to lose is set (which you can check with AND), you need to set it on the other end (which you can do after the shift with OR)[2014-10-21. : 3:17 am] O)FaRTy1billion[MM] -- That is, for right rotating. Left rotating would be ((a & 128) >> 7) | (a << 1) (as long as it's unsigned)[2014-10-21. : 3:15 am] O)FaRTy1billion[MM] -- dunno, you got it mostly right ... just got a bit too excited with the amount of shifting. xD |
DarkenedFantasies,
RIVE