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;
Code:
Note : I draw the walls closest to farthest and I maintain a ZBuffet
I need to visit this Buffet, sounds yummie!
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.
nops:
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
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
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
Code:
"%s.%s.%s.%s" % (blah[0], blah[1], bleh[1], bleh[2])
Code:
jr z,move_teeth_while_dead
bsr apologie
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
i m living dead
i apology
for the fake news that tell that i m dead in 2018
something is dead in me
i can't tell
for the fake news that tell that i m dead in 2018
something is dead in me
i can't tell
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)
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)
Code:
lodsb
cvtss2sd xmm4, [ParamPool + eax*4]
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
Code:
lea InitialPC(pc),a2
Code:
P+=1;f,u,r,i,o=[x[:]for x in F],[x[:]for x in U],0,0,1
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);
Code:
: dcell-make-visible
dup dcell@ c-make-visible swap dcell! ;
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];
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
(a × 10^k + b)(c × 10^k + d) = ac × 10^(2k) + (ac + bd – (a – b)(c – d)) × 10^k + bd
@baah this looks like forth but weird (as in regular forth is not weird), what's that?
from today's casual forthing
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 ;
@svo: it's SockZ, own implementation of forth handling large integers: http://abrobecker.free.fr/sockz/sockz.htm
No more supported...
No more supported...
@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.
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.