Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

BINARY

Name: Anonymous 2007-08-24 13:36 ID:qBy4HDJp

unsigned invert(unsigned x, int p, int n){
        return (x & ~((~(~0 << n))<<(p-1))) ^ ((~(~0 << n))<<(p-1));
   
    }

post more binary things..............show me neat things to do (*≧▽≦)

Name: Anonymous 2007-08-24 13:38 ID:Heaven

01010100011101110110000101110100

Name: Anonymous 2007-08-24 13:43 ID:nDaD3oYx

int bitcount(unsigned int n)                         
 {
    /* works for 32-bit numbers only    */
    /* fix last line for 64-bit numbers */
   
    register unsigned int tmp;
   
    tmp = n - ((n >> 1) & 033333333333)
            - ((n >> 2) & 011111111111);
    return ((tmp + (tmp >> 3)) & 030707070707) % 63;
 }

Name: Anonymous 2007-08-24 14:24 ID:PvOVjqyM

int oddp
 (int n)
  { return n&1; }

Name: Anonymous 2007-08-24 14:30 ID:PvOVjqyM

int pow2p
 (int n)
  { return !(n & n-1); }

Name: Anonymous 2007-08-24 14:31 ID:Heaven

>>5
1) You fucking fail and suck
2) C isn't "PYTHON" or "LASP" or whatever faggot language you come from
3) & has higher precedence than -, see 1) you fail
4) ... FAIL

Name: Anonymous 2007-08-24 14:34 ID:PvOVjqyM

>>6
int pow2p
 (int n)
  { return !(n & (n-1)); }

Name: Anonymous 2007-08-24 14:37 ID:Heaven

>>7
int
pow2p (int n)
{;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;return !(n & (n - 1));;;;;
};;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Name: Anonymous 2007-08-24 15:06 ID:Heaven

POWER 2 THE PPL

Name: Anonymous 2007-08-24 16:54 ID:Y77hP+ho

should it not be something like:

int pow2p (int n)
{ return ~(n & (n-1)); }

of course I'm tired and stoned, so maybe I fail.

Name: Anonymous 2007-08-24 16:57 ID:Heaven

Nice parens, faggots, maybe try Lisp already

Name: Anonymous 2007-08-24 17:11 ID:PvOVjqyM

>>10
nah you win

Name: Anonymous 2007-08-24 18:47 ID:Y77hP+ho

>>12
nice one

Name: Anonymous 2007-08-24 19:01 ID:CfwIDNqW

>>11
(question? you (mean (define pow2p (lambda (n) (~ (& n (- n 1)))))))

Name: Anonymous 2007-08-24 23:19 ID:gi2iXmwf

>>7
nice style! maybe I'll try it someday for the dozen of one line functions I have lying around in my C programs.

Name: Anonymous 2007-08-24 23:35 ID:SaQAVIVa

ITEM 175 (Gosper)

Name: Anonymous 2007-08-26 23:00 ID:Pf63gW6F

int maskn
 (int n)
  { return (1<<n)-1; }


maskn(0) = 0b0
maskn(1) = 0b1
maskn(2) = 0b11
maskn(3) = 0b111

Name: Anonymous 2007-08-27 9:41 ID:QCdyrCYR

>>14
Why of course

Name: Anonymous 2007-08-27 10:26 ID:Heaven

>>18
Stop bumping old threads, dyrcyr

Name: Anonymous 2007-08-27 16:15 ID:gZGIRnx+

>>19
Stop saging old threads, eave

Name: Anonymous 2007-08-27 17:45 ID:Heaven

>>20

Fuck you, Anon.

Name: Anonymous 2011-01-31 21:30

<-- check em dubz

Don't change these.
Name: Email:
Entire Thread Thread List