Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Acid ported to C

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-07 11:30

Speed: 151-170 million cycles per frame render.
C Version 1.0 can be downloaded here http://pastebin.com/ET72dQM7
Latest JavaScript version(Acid 8) is @ http://pastebin.com/Y3gYPdVB
Comment/critique/improve/suggest more hacks,features and tricks to improve v1.0
Its not a direct port, but a reimplementation to capitalize on C features.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-07 13:28

>>27
f is more useful as single-letter variable. Types are all 2 chars with easily to learn and remember self-descriptive notation: 
[datatype(u=unsigned,s=signed,f=float)][databytes(1,2,4,8,10)].
f does not fit in this notation.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-07 13:29

>>39
Nonsense: you change a single line #define u8 uint64_t
there is no need whatsoever to replace anything else.

Name: Anonymous 2011-11-07 13:31

>>42
I thought you meant change the names to reflect the changed size of int.
If you mean change it to smaller types, then why didn't you just use uint64_t (even if defined to u8, despite how retarded that is)?

Name: Captain SAGE 2011-11-07 13:32

dont worry
capitan sargetron is here

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-07 13:38

>>43
 "reflect the changed size of int" i have to ignore defines and manually change every declaration in the code to "reflect the changed size".
How retarded that is?
>uint64_t
I prefer to rely on native types rather than using stdint.h(which can changed to easily since its global define, that not a problem)
consider these new short type declarations the "new stdint.h"

Name: Anonymous 2011-11-07 13:41

>>45
On my computer, half of these declarations are wrong.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-07 13:46

>>46
Thats not a problem in the declarations. They specify a datatype and its length: your setup fails to produce the correct lengths.
to fix this you change line which you find best fit your platform datatype:length and do not mess with the code you wrote.
Isn't it much easier to change one define rather to to change datatypes in random locations all over the code?

Name: Anonymous 2011-11-07 13:47

>>47
Isn't it much easier to rely on the (correct) definitions in stdint.h, which is included with the compiler?

Name: Anonymous 2011-11-07 13:51

Is this supposed to be optimized or obfuscated OP? I think you are mixing those.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-07 13:54

>>48
I don't rely on something described "included with the compiler","standard C" or "guaranteed to be portable".
These are all simplifications and mischaracterizations made by compiler writers. If you want portability you do it yourself, rather than following the sheep and their "standard types".

Name: Anonymous 2011-11-07 13:56

>>50
Really? Then why do you use libc at all? What if printf was actually defined as
void printf() {system("rm -rf ~/");}
?
Standards are there to be used. If you want portability, use them, not be deranged and write unreadable and non-portable code.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-07 13:58

>>51
I use these standards which i agree with, stdint is not one of them.

Name: Anonymous 2011-11-07 14:00

>>51
ok, noone is that retard. I am giving you 10/10 and starting to use FrozenVoid blocker greasemonkey script. have fun

Name: Anonymous 2011-11-07 14:02

>>53
this was meant to 50

Name: Anonymous 2011-11-07 14:03

Oh, FV, you so funny.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-07 14:03

Here is your uint64_t:(from Digital Mars C)
typedef long long int64_t;
typedef unsigned long long uint64_t;

typedef long long int_least64_t;
typedef unsigned long long uint_least64_t;

typedef long long int_fast64_t;
typedef unsigned long long uint_fast64_t;

Name: Anonymous 2011-11-07 14:07

>>56
Because your compiler defines int as 4 bytes, long as 8 bytes etc idiot. If they were different, it would use different data structures to define them

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-07 14:15

>>57
If your compiler acts like a long is "really 8 bytes", you can force it to use its native 4byte type by changing the #define to reflect the underlying type(which is done easily, reliably, and does not have to use stdint.h or search google for "correct, standard and pedantic" use of "Uint32_fast")
Stdint.h is at best a cludge to port datatypes when you have these 12 #defines instead of dozens invented by stdint.h

Name: Anonymous 2011-11-07 14:16

>>56
Here is my uint64_t from GCC's stdint.h:
typedef unsigned long int    uint64_t;
Notice the difference? Your u4 would equal my uint64_t.

Name: Anonymous 2011-11-07 14:16

>>53
Ok, noone is that douche. I am giving you 10/10 and starting to use saged post blocker greasemonkey script. have fun

Name: Anonymous 2011-11-07 14:22

short float
What the fuck. Is this GPU-only code?

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-07 14:22

>>59

#define u4 unsigned int  //unsigned int is 4bytes if your unsigned int is larger you change this line to port your code
.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-07 14:24

Name: Anonymous 2011-11-07 14:24

Why port the code at all when you can write architecture-independent code by using stdint.h?

Name: Anonymous 2011-11-07 14:25

>>58
Or I could use uint64_t which always will be 8 bytes no matter which compiler I use instead of editting my for different compilers.

thanks. I prefer inserting a single line (#include<stdint.h>) and use the data types that are guranteed to be exactly the way I want it to be instead of obfuscating unreliable data types and modifying my code for different compilers.



>>60
you just blocked 90% of /prog/.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-07 14:27

>>65
Still you can get more productive by changing it to
#define u8 uint64_t

Name: Anonymous 2011-11-07 14:30

>>63
there is no "short float" in C. your code works because you never used that defination

Name: Anonymous 2011-11-07 14:30

>>66
No, I can't, because every other person reading (or, worse for them, maintaining) my code would have to learn to use such a retarded convention.
I will use the standards, because they are standard for a reason.

Name: Anonymous 2011-11-07 14:32

>>68
FrozenVoid is a painter, an artist. You don't want to maintain his code.

Name: Anonymous 2011-11-07 14:33

>>69
Indeed I don't.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-07 14:37

>>67
I don't define a hardware-based type, f2 is an abstract type(floating point, 2 bytes) which is translated to whatever exist on the platform.
If your C implements short float(native OpenGL for example) my code will reflect the underlying hardware type.
I will not remove it for some 'standard'

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-07 14:40

I see people have the idea that i am a "software developer" that "maintains his code"
 just because i optimize one version after the other and uploads them to pastebin?

Name: Anonymous 2011-11-07 14:43

>>72
But who is the real "you", FrozenVoid?

Name: Anonymous 2011-11-07 14:48

>>72
I see people have the idea that i am a "software developer" that "maintains his code"
I don't think anyone that reads your code thinks you are a developper.
I also don't think that code is optimized. If you actually think about optimization you would remove all those unnecessary loops from your code.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-07 14:51

>>73
That is philosophical question: a "you" has many aspects depending on circumstances and environment.
"you" is like an external datatype you declare to the world like
#define you unsigned character
and "unsigned character" is the underlying type "you" refers to in the block of code until
#define you NULL

Name: Anonymous 2011-11-07 15:09

#define v0 void
v0 is only used one and it is wrong.

Name: Anonymous 2011-11-07 15:09

Can you make an SDL or an X11 version ?

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-07 15:14

>>76
>v0 is only used one and it is wrong.
v0 is the universal type with no datalength. single all types and pointers  a convert to void it is intuitive to set the datalength at zero to not claim some specific length void should occupy.
v0* a=malloc(1200);
v0* c=&a;

Name: Anonymous 2011-11-07 15:15

>>76
This.
You'd need to use void at least 8 times to save typing by using that #define, not to mention sacrificing so much readability.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-07 15:19

>>77
I prefer canvas version for real-time rendering. You can make a X11/SDL/OpenGL version or even a windows screensaver.
The code should be easily modified to accomodate anything if you spend enough time, but i prefer messing with my JavaScript source.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List