Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Favorites infavorites:mine
infavorites:1234
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with Search options answers only user 17602

For challenges involving doing something on the bit level.

0
votes
Batch, 92 bytes @set m=%1 @set f=@for %%i in (%*)do @ %f%set/a"m=m+(m-=%%i)*(m>>31) %f%cmd/cset/a!(m-%%i) Takes arguments as command-line parameters in reverse order. Works by arithmetically calcul …
answered Mar 13 by Neil
0
votes
JavaScript (ES6), 32 bytes (n,m=32)=>(--m&&f(n,m)*2)|n>>m&1 Wrote this while trying to solve Bit-Reversal Permutations - it didn't help there, but it works fine here!
answered Jun 20 '16 by Neil
5
votes
JavaScript (ES6), 120 bytes f=(a,n,b=0,t=0,r=[])=>b<n?a.length?f(a.slice(1),n,b+8,t*256+a[0],r):b?[...r,t<<n-b]:r:f(a,n,b-=n,t&(1<<b)-1,[...r,t>>b]) Recursive bit twiddling on integer arrays. Ungol …
answered Mar 22 '16 by Neil
1
vote
vi, 27 bytes 8I0<ESC>$7hc0lxp<ESC>l"qd0xp3@q03@q Where <ESC> represents the Escape character. I/O is in binary, output is padded. 24 bytes in vim: 8I0<ESC>$7hd0xpqqlxpq2@q03@q
answered Jun 30 '16 by Neil
2
votes
JavaScript (ES6), 180 bytes f=(s,t=(s+`\0\0\0\0`).replace(/[^]/g,(c,i)=>(c.charCodeAt()+256*!!i).toString(2).slice(!!i)))=>t[32]?f(s,t.replace(/.(.{32})/,(_,m)=>(('0b'+m^79764919)>>>0).toString(2))): …
answered May 1 '16 by Neil
2
votes
Charcoal, 25 bytes ⭆θ◧⍘℅鲦⁷←Wⅈ←I﹪⍘KD²←01 ²1 Try it online! Link is to verbose version of code. Explanation: ⭆θ◧⍘℅鲦⁷← Convert all the characters to binary and pad them to a length of 7 and the …
answered Jul 10 by Neil
1
vote
Charcoal, 11 bytes I↨﹪θ¹²⁸¦¹²⁸ Try it online! Link is to verbose version of code. Takes input as an array. Explanation: θ Input array ﹪ ¹²⁸ Elementwise modulo 128 ↨ ¹²⁸ Conver …
answered Aug 7 by Neil
8
votes
ES6, 84 bytes a=>(i=e=0,a.reduce((x,y)=>(z=1<<31-Math.clz32(x^y),x>y?i|=z:y>x?e|=z:z,y)),i&e?-1:i) Edit: By the time it took me to write the answer the algorithm had already been independently post …
answered Dec 31 '15 by Neil
7
votes
JavaScript (ES6), 34 33 bytes f=n=>n?f(n&1?~n:n/2)+'<~'[n&1]:'' <input type=number oninput=o.textContent=f(this.value)><pre id=o> Works for any 32-bit integer.
answered May 6 '17 by Neil
2
votes
ES6, 130 bytes (n,m)=>{for(a={},s=0,i=x=y=1;i<<1;i+=i,z=y,y=x,x+=z)s+=((n&i)+(m&i))/i*(a[i]=x);for(r=0;i;i>>>=1)s>=a[i]?(s-=a[i],r|=i):0;return r} I originally tried to compute the sum in-place (ef …
answered Jan 31 '16 by Neil
3
votes
JavaScript (ES6), 84 72 bytes (s,p)=>(t=p>'e',[...s].map(c=>t^=c.charCodeAt()),t^=t/16,t^=t/4,t^t/2)&1 Bit twiddling turned out to be shorter than converting to base 2 and counting 1s.
answered Apr 25 '16 by Neil
1
vote
Charcoal, 31 bytes NθI⌊EΦEθ↨×ιι²⁼LιL↨θ²ΣE↨責⁼λ§ιμ Try it online! Link is to verbose version of code. Explanation: Nθ Input N θ N E …
answered Aug 8 '18 by Neil
7
votes
JavaScript (ES6), 30 bytes f=n=>n*4&84|n*2&128|n/2&1|n/4&42
answered Jun 29 '16 by Neil
4
votes
JavaScript (ES6), 31 bytes (n,m)=>n^m&(n^(n*=257)>>1^n>>7)
answered Nov 5 '16 by Neil
1
vote
JavaScript (ES6), 33 bytes f=(n,m)=>n<m?f(n|n+1,m&m-1):[n,m] Simple port of the answers by @miles.
answered Jun 17 '16 by Neil

15 30 50 per page