pouët.net

Random line of code thread

category: code [glöplog]
Code:text-shadow:-0.06em 0 red,0.06em 0 cyan;
added on the 2013-10-23 18:33:33 by Suborg Suborg
Code: subq.w #4,(a0) ; $4e75->$4e71; rts->nop
added on the 2013-11-19 10:19:39 by StingRay StingRay
Code: addq.w #1,a2 ; bgt


This line of code helped me to save quite a few bytes \o/
added on the 2013-12-04 18:32:14 by StingRay StingRay
Code:jmp loop
added on the 2013-12-04 19:04:41 by Preacher Preacher
Quote:
Code: subq.w #4,(a0) ; $4e75->$4e71; rts->nop


Love it :D
added on the 2013-12-04 21:34:44 by xeron xeron
I sense devilry ;D
added on the 2013-12-04 22:54:05 by Preacher Preacher
This is quite an evil size optimisation used in the boot intro I planned to release at FAP. For now I have to admit defeat though as I didn't manage to cut it down to 1024 bytes despite lots of such tricks, the code is nearly unreadable! :D Let's see if I can make it for FAP 2014. :) For the 2013 edition I have a plan C intro ready. :)
added on the 2013-12-04 23:09:25 by StingRay StingRay
Code:} else {
added on the 2013-12-05 14:09:33 by jobe jobe
Code:int ReturnValueFromType(const void *address, string type) { char *c=(char*)address; unsigned char *uc=(unsigned char*)address; short *s=(short*)address; unsigned short *us=(unsigned short*)address; int *i=(int*)address; unsigned int *ui=(unsigned int*)address; float *f=(float*)address; return type == "char *" ? *c : type == "unsigned char *" ? *uc : type == "short *" ? *s : type == "unsigned short *" ? *us : type == "int *" ? *i : type == "unsigned int *" ? *ui : type == "float *" ? *f : 0; }
added on the 2013-12-07 06:47:07 by rudi rudi
Code: #define SIZEOF_BITFIELD(class, member, out) \ { \ class classtmp; \ classtmp.member = ~0; \ unsigned int tmpint = classtmp.member; \ ++ tmpint; \ out = log2(tmpint); \ } unsigned int log2(unsigned int x) { if(!x) return sizeof(unsigned int) * CHAR_BIT; float f = (float)x; return (*(unsigned int *)&f >> 23) - 0x7f; } struct Test { unsigned field1 : 4; unsigned field2 : 8; unsigned field3 : 1; unsigned field4 : 3; unsigned field5 : 16; int normal_member; }; main() { size_t size[5]; SIZEOF_BITFIELD(Test, field1, size[0]); SIZEOF_BITFIELD(Test, field2, size[1]); SIZEOF_BITFIELD(Test, field3, size[2]); SIZEOF_BITFIELD(Test, field4, size[3]); SIZEOF_BITFIELD(Test, field5, size[4]); for (int i=0; i<5; i++) printf("%d\n", size[i]);
added on the 2013-12-10 19:22:57 by rudi rudi
Code:deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST);

*hint* :)
added on the 2013-12-10 21:06:30 by xTr1m xTr1m
Code:ddsadjh,kkpokññkjdsad

http://www.youtube.com/watch?v=4tZQtU8QiiY
\o/
added on the 2013-12-14 14:03:10 by swapd0 swapd0
soy un programmador!
BB Image
Apparently competing for ioccc?
added on the 2013-12-14 18:17:10 by baah baah
Code:void interruptsCallback() { #ifdef PROJECT_CPC __asm di ld (arwstia),hl pop hl ld (arwstokode+1),hl ld hl,0:push hl pop hl ld hl,(arwstia) ld (sp_save),sp ld sp,&F800 push af push bc push de push hl push ix push iy exx push hl push de push bc exx ex af,af' push af ex af,af' ld a,(_halt_num) inc a ld (_halt_num),a cp 1 jr nz,no_halt1 ld a,&44 jr palvale no_halt1: cp 2 jr nz,no_halt2 ld a,&55 jr palvale no_halt2: cp 3 jr nz,no_halt3 ld a,&5c jr palvale no_halt3: cp 4 jr nz,no_halt4 ld a,&58 jr palvale no_halt4: cp 5 jr nz,no_halt5 ld a,14 kourasi1: dec a jr nz,kourasi1 ld a,&5d jr palvale no_halt5: cp 6 jr nz,no_halt_loop ld a,8 kourasi2: dec a jr nz,kourasi2 call _playMusic xor a ld (_halt_num),a ld a,&54 no_halt_loop: palvale: ld c,11 kourasi0: dec c jr nz,kourasi0 ld bc,&7f00:out (c),c:out (c),a:ld c,&10:out (c),c:out (c),a ex af,af' pop af ex af,af' exx pop bc pop de pop hl exx pop iy pop ix pop hl pop de pop bc pop af ld sp,(sp_save) ei arwstokode: jp 0 arwstia: dw 0 __endasm; #endif }
added on the 2014-01-16 01:35:25 by Optimus Optimus
Code:int ProductOfDigits(int n) { int p=1; do{ p=p*(n%Base); n=n/Base; } while(n>0); return(p); }
added on the 2014-01-16 12:40:18 by baah baah
Code: #define DoThat(P,E,N,I,Z) { 10 ?"P E N I Z! "; 20 GOTO 10 } DoThat(Come, to, Revision, teh, Fuck);
why the fuck do we use "code"-BBCode again, if the indentation doesnt work anyway? is that a bug of pouet2.0?
Code: "movl $0x3F3F3F3F,%%ebx\n\t" "movl -1(%%edi),%%eax\n\t" "addl 1(%%edi),%%eax\n\t" "addl -320(%%edi),%%eax\n\t" "addl 320(%%edi),%%eax\n\t" "shrl $2,%%eax\n\t" "andl %%ebx,%%eax\n\t" "movl %%eax,(%%edi)\n\t" "addl $4,%%edi\n\t" "decl %%ecx\n\t"


AT&T FCUKkkk
added on the 2014-02-07 21:41:03 by Optimus Optimus
Haha, this one is slower

add eax , [edi + 4]
add eax , [edi + 1280]
add eax , [edi - 1280]

than this

mov edx , [edi + 4]
add edx , [edi - 1280]
add edx , [edi + 1280]
lea eax , [edx + eax]
added on the 2014-02-07 22:34:24 by Optimus Optimus
Code:if(pChn->nPanbrelloPos == 0 || pChn->nPanbrelloPos >= pChn->nPanbrelloSpeed) { pChn->nPanbrelloPos = 0; pChn->nPanbrelloRandomMemory = static_cast<int8>(pdelta); } pChn->nPanbrelloPos++; pdelta = pChn->nPanbrelloRandomMemory;
Ok,. some time ago I used ARJ to compress a big file to many volumes succesfully.

I try again and I fail every time. The file is a ZIP of 3Megs, I want to compress to volume of around 700kb with arj a -v700000 dos.zip dos.arj
It make an arj of volume 700k and stops there. All the time. With different tests, maybe it should not be dos.arj maybe *.*, maybe this maybe htat
I did this all the time.

Then I do the same on the folder DOS. And it fucking works!!!
Wtf? If I point to a single file it stops producing many volumes? But not in multiple files? What is that madness???

Anyway,. problem is I have a 286 with 720k but dos6.22 is only 1.44 images on the internet.
added on the 2014-02-08 15:20:18 by Optimus Optimus
Code: void main // (int o, char ** O){((int (*) ()) 0) () ; }


segfault me beautiful

(and platform indepentent) 8]
added on the 2014-02-09 18:57:52 by k00n k00n
Code: model.transform.localRotation = Quaternion.Euler(new Vector3( 0.0f, Time.time, 0.0f)) * model.Transform.localRotation;


mmmh, models...you gotta love em, if they keep rotating locally!
Code::InterruptStart()
added on the 2014-02-10 10:41:23 by Preacher Preacher
Code:move.w #$20,$dff01e ;interrupt ok

login