Random line of code thread
category: code [glöplog]
what a nice loop counter...
Code:
TEST SP,SP
JPE .2
Code:
// trim trailing zeros, as it will be zeroed out by the kernel when it
// creates the page mapping anyway
for (; writesz > 1 && !textd[writesz - 1]; --writesz) ;
And this isn't even the worst part of the code.
Part of a linker for static, standalone ELF files, the output files seem to be ~300 bytes smaller than using 'bold --raw'.
Code:
move.l #$8000,$8000 ; Fix trackdisk.device bug
Code:
umlallss r1, r3, r0, r2 @Wow, that actually assembled!
Code:
lea Font-" "*8(pc),a0
Hexagonal coordinates of cells on top/bottom of (x;y):
Code:
// # # # # # # # y=0
// # # . . . # # y=1
// # # . . . . # y=2
// # . . . . . # y=3
// # # . . . . # y=4
// # # . . . # # y=5
// # # # # # # # y=6
x2=x-1+((y+FirstShift)%2);
x3=x+((y+FirstShift)%2);
[scratchblocks]
when green flag clicked
forever
turn cw (15) degrees
end
[/scratchblocks]
when green flag clicked
forever
turn cw (15) degrees
end
[/scratchblocks]
0001 01011111
0002 01000000
0003 01011110
0004 01000000
0005 10110000
1110 11000011
1111 00111100
0002 01000000
0003 01011110
0004 01000000
0005 10110000
1110 11000011
1111 00111100
Code:
and 3
swap a
rla
rla
(context: converting a number from 0 to 3 to a Game Boy pulse width value)
Code:
leer vierkant
herhaal 4 [ vooruit 100 rechts 90 ]
eind
herhaal 200 [ vierkant rechts 2 ]
Code:
emit resizerSizeChanged(SchematicCanvas::nodeRealSize(newSize));
Code:
printf("%i",[](){int n;for(int c;c<1000;c++){!(c%5)||!(c%3)?n+=c:0;}return n;}());
Code:
lea BoardRows+BOARDWIDTH/16+LINESTRIDE/4,a2
Code:
cmp.l ShitBufPtr(pc),a0 ; should be fixed one day
Code:
// The Renderable property in the SVG loader is protected, but we're using C# here and don't give a damn :)
var renderableP = typeof(Svg.SvgVisualElement).GetProperty("Renderable", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
Because fuck you, person who designed that library and didn't think of me.
Quote:
Code:// The Renderable property in the SVG loader is protected, but we're using C# here and don't give a damn :) var renderableP = typeof(Svg.SvgVisualElement).GetProperty("Renderable", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
Because fuck you, person who designed that library and didn't think of me.
His fault when the library gets updated and his code breaks. But he'll blame the library devs anyway.
Actually that was my own code :) and I don't blame anyone. It's even an OSS lib that's built as part of our build process so it'd be easy to change the lib itself at that point. But I decided against it - the hassle of having custom modifications in your open source dependencies and then trying to update them is way worse that that one line of workaround. And if it breaks, it'll break the integration tests instead of at compile time. I can live with that. :)
(And no hard feelings towards whoever originally wrote that svg library. It works really well, and we even submitted a bug fix PR that has been merged. Be nice to your open source creators, people :)
(And no hard feelings towards whoever originally wrote that svg library. It works really well, and we even submitted a bug fix PR that has been merged. Be nice to your open source creators, people :)
Code:
#ifdef _DEBUG
char* args = GetCommandLineA();
while (*(args + 4) != 0) {
if (args[0] == 'D' && args[1] == 'U' && args[2] == 'M' && args[3] == 'P') {
dump = 1;
break;
}
args++;
}
#endif
Code:
LD HL,SEX
found this little gem in some game boy sound driver source
Anyone using this instead of modulus? and is it faster?
Code:
(uint64)(((__uint128_t)x * (__uint128_t)y) >> 64);
Code:
if(typeid(*intersectables[i]) == typeid(Triangle))
*runtime screams of pain*
[gml]
x = originX+(sin(y/8)*80)
y -= 0.5
[/gml]
x = originX+(sin(y/8)*80)
y -= 0.5
[/gml]
Code:
FLOAD uy,t
FMUL Wy
FADD Xy
FMUL t
FADD Yy
FMUL t
FADD Ay
Code:
; last file from disk 1 has been loaded, now patch the
; fucking shit...
Code:
mov cl,al ;backup for blood test