# Tag Info

### Floating Point XOR

x86-64 machine code, 4 bytes 0f 57 c1 c3 In assembly: xorps xmm0, xmm1 ret This is a callable function that takes two floats ...
• 1,419

### Find the number of leading zeroes in a 64-bit integer

x86_64 machine language on Linux, 6 bytes 0: f3 48 0f bd c7 lzcnt %rdi,%rax 5: c3 ret Requires Haswell or K10 or ...
• 7,605

### Golf bit weaving

Python 2.7, 44 -> 36 bytes lambda x:x/4&42|x*2&128|x*4&84|x/2&1
• 1,241

### Different number, same weight

x86-64 assembly, 5 4 bytes 0: 97 xchg %eax,%edi 1: d1 c0 rol %eax 3: c3 retq A ...
• 39.7k

### Calculate the longest series of 1's in an integer's binary value

JavaScript (ES6),  33  32 bytes f=x=>x&(k=x>>1)?f(x&k):k&&1+f(k) Try it online! JavaScript (ES6),  41 40 36  34 bytes Saved 4 bytes ...
• 193k

### Find the number of leading zeroes in a 64-bit integer

Hexagony, 78 70 bytes 2"1"\.}/{}A=<\?>(<$\*}[_(A\".{}."&.'\&=/.."!=\2'%<..(@.>._.\=\{}:"<><$ Try it online! Isn't this challenge ...
• 17.3k
Accepted

### Calculate the longest series of 1's in an integer's binary value

Jelly, 10 8 bytes Ba\ÐƤṀċ¬ Try it online! How it works ...
• 210k

### Compress 8 bits to 6 when certain bit patterns will never occur

Python, 60 bytes l=[n^170for n in range(256)if n&n*2<1] l.index,l.__getitem__ Try it online! l.index compresses and <...
• 145k

### Bitflip and negate

Python, 32 bytes lambda x:("-~"*abs(x))[x<0:]+"0" Anonymous lambda function. Given an integer x writes "-~" abs(x) times and ...
• 2,392

### Bitflip and negate

JavaScript (ES6), 33 31 bytes f=x=>x<0?"~"+f(~x):x&&"-"+f(-x) Recursion < built-ins < loops (at least in this case). Basically unevaluates ...
• 50.1k

• 71.5k

### Can a neural network recognize primes?

Trial division: score 59407, 6243 layers, 16478 neurons in total Given as a Python program which generates and validates the net. See the comments in trial_division...
• 43.1k
Accepted

### Mean bits: an average challenge

Pyth, 6 bytes .Oml.B Try it online here. ...
• 25.7k

### Calculate the longest series of 1's in an integer's binary value

x86/x86-64 machine code, 14 bytes (TODO: 13 bytes with input in EAX, return value in EDX). Using @Arnauld's algorithm of x &= x>>1 and taking the highest ...
• 4,837

### Compute CRC32 Hash

Intel x86, 34 30 29 27 bytes Takes the address of the zero-terminated string in ESI, and returns the CRC in EBX: ...
• 789
Accepted

### "Bit-borrow" two numbers

Jelly, 11 bytes ~1¦&N\$^µ</¿ Try it online! or verify all test cases. Background We can extract the last set bit of an integer n as follows. n + 1 ...
• 210k

### Folding Numbers

Jelly, 9 bytes Bœs2µḢ^UȦ Try it online! or verify all test cases. How it works ...
• 210k

### Alternating bit smearing

Python 3, 20 bytes lambda n:(n&-n)//3+n Try it online! Explanation Take 192 as an example. Its binary form is ...
• 49.8k

### Find the number of leading zeroes in a 64-bit integer

Python, 31 bytes lambda n:67-len(bin(-n))&~n>>64 Try it online! The expresson is the bitwise & of two parts: <...
• 145k

### Decode a variable-length quantity

APL (dzaima/APL), 8 bytes 128(⊣⊥|) Try it online! How: ...
• 3,453

### Floating Point XOR

C++ (gcc), 74 32 bytes #define f(x,y)*(int*)x^=*(int*)y Try it online! I haven’t previously golfed in C++ so am grateful to all those who helped halve the size ...
• 21.1k

### Is it a valid ARM immediate value?

Rust, 52 49 bytes |n|(0..16).any(|i|(n<<33^n<<32^n*2^n)<<i*2>>41<1) Attempt This Online! A closure that takes an unsigned 32-bit value ...
• 77k

### Golf bit weaving

CJam, 15 12 bytes Thanks to FryAmTheEggman for saving 3 bytes. l8Te[m!6532= Input in base 2. Output also in base 2, padded to 8 bits with zeros. Test it here. ...
• 197k

### Bitflip and negate

Pyth, 14 13 12 Bytes _<>0Q+0sm"~- -2 Bytes thanks to @StevenH. test suite Decided to try out Pyth, so i translated my python answer to it. Any help ...
• 2,392

### Find the number of leading zeroes in a 64-bit integer

C (gcc), 14 bytes __builtin_clzl Works fine on tio C (gcc), 35 29 bytes f(long n){n=n<0?0:f(n-~n)+1;} Try it online! ...
• 24.5k

### Inverting string-based binary number in one line in Python

Python 3,  51 44 43  41 bytes -7 thanks to loopy walt's suggestion to use *open. -1 thanks to xnor's suggestion to replace ...
• 108k