Search:

Type: Posts; User: pyroknife

Search: Search took 0.01 seconds.

  1. Replies
    14
    Views
    1,176

    Thank you guys. THis explanation really helped. ...

    Thank you guys. THis explanation really helped.
    I forgot in the while argument that #>0, where # is represented in decimal and not binary.
  2. Replies
    14
    Views
    1,176

    0*2^0+1*2^1=2

    0*2^0+1*2^1=2
  3. Replies
    14
    Views
    1,176

    Does this have anything to do with bits=~0? ...

    Does this have anything to do with bits=~0?

    What if you had bits=101. Wouldn't this yield size=1, since the while loops well terminate once it hits the "0" in "101."
  4. Replies
    14
    Views
    1,176

    Yes, I think I understand that, but why does bits...

    Yes, I think I understand that, but why does bits have to be >0?
    A bit can be 0 or 1. So why is it exclusively 1 in this case?
    Is it because before the while loop bits is set equal to ~0?
  5. Replies
    14
    Views
    1,176

    Help with programming with bits

    THe problem statement asks "Given that the expression ~0 produces an integer that contains all 1s, write a functioncalled int_size that returns the number of bits contained in an int on your...
Results 1 to 5 of 5