pouët.net

Random line of code thread

category: code [glöplog]
Code:// sanity check: if distance is bogus, skip anyway newpt = intersect(oldpt, sphere[i]); if (abs(dist(sphere[i].pos, newpt)-sphere[i].radius) >= 0.07) continue;
added on the 2018-11-11 16:25:55 by porocyon porocyon
Code:Note : I draw the walls closest to farthest and I maintain a ZBuffet


I need to visit this Buffet, sounds yummie!
added on the 2018-11-14 20:04:07 by Optimus Optimus
nop
It's Friday, so it's time to write SUPER HIGH QUALITY CODE again:

Code:stat.CurrentZoom = (int)(100.0 * Math.Pow(1.2, Host.ZoomLevel)); // this asserts in CEF debug builds bc we're totally in the wrong thread but it's an int getter so shut up, really.
added on the 2018-11-23 13:45:09 by kb_ kb_
nops:
nop
nop
nop
nop
nop
nop
nop
nop
added on the 2018-11-23 14:19:33 by visy visy
towerofpixset:
or.b d5,0(a0) ; d5 = 128
or.b d4,0(a0) ; d4 = 64
or.b d3,0(a0) ; d3 = 32
bset.b d1,0(a0) ; d1 = 4 2^4=16
or.b d2,0(a0) ; d2 = 8
or.b d1,0(a0) ; d1 = 4
bset.b d0,0(a0) ; d0 = 1 2^1=2
or.b d0,0(a0) ; d0 = 1

or.b d5,1(a0) ; d5 = 128
or.b d4,1(a0) ; d4 = 64
or.b d3,1(a0) ; d3 = 32
bset.b d1,1(a0) ; d1 = 4 2^4=16
or.b d2,1(a0) ; d2 = 8
or.b d1,1(a0) ; d1 = 4
bset.b d0,1(a0) ; d0 = 1 2^1=2
or.b d0,1(a0) ; d0 = 1
added on the 2018-11-26 12:57:17 by gloky gloky
Code:"%s.%s.%s.%s" % (blah[0], blah[1], bleh[1], bleh[2])
added on the 2018-11-26 15:48:48 by porocyon porocyon
Code: jr z,move_teeth_while_dead
added on the 2018-12-06 02:24:23 by gasman gasman
bsr apologie
added on the 2018-12-09 13:49:39 by gloky gloky
Code:if (ordered_taco = true) then: order taco(flavor = taco_flavor, location = order_location); if (taco_flavor = diarrhea) then: say("Sorry, we don't serve that flavor"); endif; endif;
i m not dead
i m living dead
added on the 2018-12-10 12:41:42 by gloky gloky
i apology
for the fake news that tell that i m dead in 2018
something is dead in me
i can't tell
added on the 2018-12-11 01:03:21 by gloky gloky
if rotation_option is not None:
if not os.path.exists('corrected'):
os.mkdir('corrected')
logFiles = glob.glob('*.log')
copyfile(logFiles[0], 'corrected/'+logFiles[0])
imageNameBase = logFiles[0][:-4]

searchTerm = imageNameBase+('[0-9]' * 4)+'*.tif'

imageFiles = glob.glob(searchTerm)

for item in imageFiles:
image = Image.open(item)
image_rotated = image.rotate(rotation_option)
rotatedFilename = str('corrected\\')+item
image_rotated.save(rotatedFilename)
added on the 2018-12-14 10:27:24 by baldrick baldrick
Code:lodsb cvtss2sd xmm4, [ParamPool + eax*4]
added on the 2018-12-14 16:39:53 by Blueberry Blueberry
From OldNewThing msdn blog:
Code: ; ; Invalidate the processor cache so that any stray gamma ; rays (I'm serious) that may have flipped cache bits ; while in S1 will be ignored. ; ; Honestly. The processor manufacturer asked for this. ; I'm serious. ; invd
added on the 2018-12-15 07:49:06 by MiDoRi MiDoRi
Code:lea InitialPC(pc),a2
added on the 2018-12-16 18:44:52 by StingRay StingRay
Code:P+=1;f,u,r,i,o=[x[:]for x in F],[x[:]for x in U],0,0,1
added on the 2018-12-19 10:32:09 by KeyJ KeyJ
Code: #define WARP_SIZE 256 int warpCount = (int)ceil((float)particleCount / WARP_SIZE); context->CSSetShader(pCS, 0, 0); context->CSSetConstantBuffers(0, 1, &pCBuffer); context->CSSetUnorderedAccessViews(0, 1, &particleBuffer->pParticlesUAV, NULL); context->Dispatch(warpCount, 1, 1);
added on the 2018-12-19 11:07:54 by arm1n arm1n
Code: : dcell-make-visible dup dcell@ c-make-visible swap dcell! ;
added on the 2018-12-20 09:39:22 by svo svo
Code: volatile int syncpipe[2]; SYS_pipe(syncpipe); // *sometimes*, the syncpipe vars are put at the top of the stack // (apparently only when using incremental linking), and SYS_pipe writes // to the stack (to load the syscall num into rax), so the values get // garbled... this should fix it register int readend = syncpipe[0], writeend = syncpipe[1];
added on the 2018-12-28 02:36:04 by porocyon porocyon
Code:;Karatsuba multiplication - 2003aug29 by baah/Arm's Tech #k* OVER2 LOG2 OVER2 LOG2 ;B A log2(A) log2(B) SKIP>= SWAP2 ;Here B A with log2(B)>=log2(A) #k*sorted COPY LOG2 31 ;B A log2(A) 31 SKIP> k*normal ;If log2(A)>31 continue Karatsuba mul OVER2 32 >> ;B A uB=B>>32 OVER2 32 >> ;B A uB uA=A>>32 OVER2 32 << ;B A uB uA uB<<32 5 OVER - NEG ;B A uB uA dB=B-uB<<32 OVER2 32 << 5 OVER - NEG ;B A uB uA dB dA=A-uA<<32 COPY2 * ;B A uB uA dB dA dB*dA COPY 32 << + ;B A uB uA dB dA dB*dA*(2^32+1) 7 SWAP DROP ;dB*dA*(2^32+1) A uB uA dB dA 3 OVER - ; " A uB uA dB dA-uA 4 OVER 3 OVER - ; " A uB uA dB dA-uA uB-dB k* 32 << ; " A uB uA dB (dA-uA)*(uB-dB)*2^32 5 SWAP DROP2 ; " (dA-uA)*(uB-dB)*2^32 uB uA k*sorted ; " " uB*uA COPY 32 << + 32 << ; " " uB*uA*(2^64+2^32) + + END .k*normal * END
added on the 2018-12-28 18:00:47 by baah baah
(a × 10^k + b)(c × 10^k + d) = ac × 10^(2k) + (ac + bd – (a – b)(c – d)) × 10^k + bd
added on the 2018-12-28 18:03:12 by baah baah
@baah this looks like forth but weird (as in regular forth is not weird), what's that?

from today's casual forthing
Quote:

: inv-vacant
INVENTORY-SIZE 0 do
i (i-data) }i-quant @ 0= if
i unloop exit
then loop -1 ;
added on the 2019-01-01 20:09:08 by svo svo
@svo: it's SockZ, own implementation of forth handling large integers: http://abrobecker.free.fr/sockz/sockz.htm
No more supported...
added on the 2019-01-01 21:51:27 by baah baah
@baah that's really impressive!
I'm taking a yearly dab at writting a rogue clone in forth. The goal is to be able to run it under CP/M, though I'm not sure if I really have any goals.
added on the 2019-01-01 22:08:58 by svo svo

login