pouët.net

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'.
added on the 2017-12-24 03:51:19 by porocyon porocyon
Code: move.l #$8000,$8000 ; Fix trackdisk.device bug
added on the 2017-12-24 13:51:41 by Blueberry Blueberry
Code:umlallss r1, r3, r0, r2 @Wow, that actually assembled!
Code:lea Font-" "*8(pc),a0
added on the 2017-12-30 15:29:24 by StingRay StingRay
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);
added on the 2017-12-31 14:41:50 by baah baah
[scratchblocks]
when green flag clicked
forever
turn cw (15) degrees
end
[/scratchblocks]
added on the 2018-01-01 00:02:56 by Molive Molive
0001 01011111
0002 01000000
0003 01011110
0004 01000000
0005 10110000
1110 11000011
1111 00111100
added on the 2018-01-01 00:25:16 by thec thec
Code:and 3 swap a rla rla

(context: converting a number from 0 to 3 to a Game Boy pulse width value)
added on the 2018-01-03 04:03:08 by DevEd DevEd
Code: leer vierkant herhaal 4 [ vooruit 100 rechts 90 ] eind herhaal 200 [ vierkant rechts 2 ]
added on the 2018-01-03 13:07:07 by skrebbel skrebbel
Code:emit resizerSizeChanged(SchematicCanvas::nodeRealSize(newSize));
added on the 2018-01-03 13:58:15 by cpdt cpdt
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
added on the 2018-01-07 22:07:29 by Blueberry Blueberry
Code:cmp.l ShitBufPtr(pc),a0 ; should be fixed one day
added on the 2018-01-09 10:03:42 by StingRay StingRay
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.
added on the 2018-01-11 14:06:55 by kb_ kb_
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.
added on the 2018-01-11 16:59:59 by xTr1m xTr1m
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 :)
added on the 2018-01-11 18:06:39 by kb_ kb_
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
added on the 2018-01-14 12:31:27 by Zeal_ Zeal_
Code:LD HL,SEX

found this little gem in some game boy sound driver source
added on the 2018-01-15 04:11:05 by DevEd DevEd

login