|
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. : 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[2014-10-21. : 3:13 am] O)FaRTy1billion[MM] -- also would it be << 7? Otherwise you just move it on to the next byte[2014-10-21. : 3:09 am] O)FaRTy1billion[MM] -- It helps because in order to rotate you need to move the bit that gets pushed off the end to the other side ... otherwise you are only shifting bits[2014-10-21. : 3:01 am] jjf28 -- Dem0nDem0n shouted: Is it 00010011? yep, want help with the rest? it's a bit content-y so i'd skip it if you have a lot else to study![]() [2014-10-21. : 2:58 am] O)FaRTy1billion[MM] -- http://www.staredit.net/skins/1/images/nav.png Was this always there?[2014-10-21. : 2:56 am] O)FaRTy1billion[MM] -- I messed that up. Hopefully you get the idea ... !x == 0 when x != 0. ![]() [2014-10-21. : 2:53 am] Dem0n -- FaRTy1billionFaRTy1billion shouted: Dem0n ! is logical-not, meaning it returns only true (1) or false (0) But what does that mean when assigning it to a variable? How does it know which to return?[2014-10-21. : 2:49 am] O)FaRTy1billion[MM] -- so !0 would be 1, while ~1 would be -1 (Which unsigned char would be 255)[2014-10-21. : 2:49 am] O)FaRTy1billion[MM] -- Dem0nDem0n shouted: Do you know what assigning an unsigned char to !0 means? ! is logical-not, meaning it returns only true (1) or false (0)[2014-10-21. : 2:48 am] Jack -- Dem0nDem0n shouted: objects don't exist in C structs are basically objects![]() [2014-10-21. : 2:38 am] O)FaRTy1billion[MM] -- I think that makes sense, but I've never seen or done anything like that before[2014-10-21. : 2:37 am] Dem0n -- So since p points to the third element in array a, would r then point to the second?[2014-10-21. : 2:37 am] Dem0n -- it's int * const r = p - 1, where p is a pointer to a + 2, where a is an array[2014-10-21. : 2:35 am] O)FaRTy1billion[MM] -- I don't know how or why you would use a constant pointer ... Is it an argument?[2014-10-21. : 2:24 am] O)FaRTy1billion[MM] -- However, (3&0), using several sheets of paper, I am still at a loss.[2014-10-21. : 2:18 am] Moose -- Or a constructor, I'd be like "uhhh it's a CS term" and maybe I'd get partial credit |