Thread: Bitwise setbits function (knr 2-6)

  1. #16
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    c_lady cannot read very well, qv. her post from a few hours ago: Bit setting

    @c_lady: if you are really looking for help or information, you are not asking for it intelligently. Please read:
    How To Ask Questions The Smart Way
    There are translations into 20+ different languages if you look down the page.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  2. #17
    Registered User
    Join Date
    Mar 2010
    Posts
    94
    Give me a brake MK27! Its quite simple we are not talking here about asking questions and english literature for God sake!!! The explanations below are based on hexadecimal number right? I would like to see the explanation based on binary numbers! Its quite simple right?

    x ^ (~(~0 << n) << p)
    x = 1234 1234
    n = 8
    p = 16
    ~0 = FFFF FFFF

    Step 1: (~0 << n) = FFFF FF00
    Step 2: ~ = 0000 00FF
    Step 3: << p = 0000 FF00

    Step 4: x ^:
    1234 1234
    0000 FF00
    ---------------
    1234 ED34

  3. #18
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by c_lady View Post
    Give me a brake MK27! Its quite simple we are not talking here about asking questions and english literature for God sake!!!
    OMG it speaks! BTW: b-r-e-a-k Anyway, I'm not trying to be mean, I'm just maybe indicating why no one has helped you -- since in fact, 95% of the questions asked here DO get answered.

    The other 5% are one of the following:
    1) questions that do not make logical sense (which your initial post does not)
    2) long questions (or questions which involve a long answer) where the poster does not provide much context, or makes no effort.
    3) they involve some obscure API or whatever which in fact no one is sufficiently familiar (yours is not this).

    Even presuming an "explanation based on binary numbers" would be "quite simple" and sensible, you definitely fit into #2. Consider it from someone's else's perspective: let's say you have some spare minutes to answer questions on cboard. You look at what's been asked, and some of the questions are well thought out and provide some context to indicate how much or how little the poster understands right now (eg, by saying "I know that blah blah blah, but how come this is wrong?").

    But maybe a few of the questions are by someone completely new (and nb -- sometimes these are just spambots which repost questions dug up from elsewhere, so they can get enough posts to use the PM system for spamming), barely intelligible, totally context free, asking you to spend 20 minutes+ writing out an answer that may or may not turn out to be appropriate. Do you think I want to play hit and miss with you about this? OF COURSE I DON'T. NEITHER DOES ANYONE ELSE. If you want some respect (and better yet, a helpful reply), spend some time writing a more thoughtful question rather than something that just looks like a whim or a joke.

    How To Ask Questions The Smart Way

    I'm sure 5% of the questions will continue to go unanswered (welcome to "the few") -- it is really 100% up to you as to whether you want yours to be one of them.

    Of course, there is also the chance someone will still come along and (making a lucky guess) provide everything you want, but I wouldn't hold my breath
    Last edited by MK27; 03-10-2010 at 08:11 AM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  2. Message class ** Need help befor 12am tonight**
    By TransformedBG in forum C++ Programming
    Replies: 1
    Last Post: 11-29-2006, 11:03 PM
  3. Including lib in a lib
    By bibiteinfo in forum C++ Programming
    Replies: 0
    Last Post: 02-07-2006, 02:28 PM
  4. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 02:53 AM
  5. Question..
    By pode in forum Windows Programming
    Replies: 12
    Last Post: 12-19-2004, 07:05 PM