• Welcome to Dark Bit Factory & Gravity.
 

1k Trinity no ordinals

Started by taj, August 29, 2006

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

ninogenio

ahh now i see where you had trouble removing crt jim!

thats nuts that the compiler takes that much control. cheers for theinfo guys ill maybe try and do a 1k now ;)
Challenge Trophies Won:

taj

Quote

Cool. Are your working fellows also interesting in scene and creating tiny codes ??? The most ppl
I know doesn't even know that the scene exists and that there are size competitions like 1KB / 4KB.

Wll Im their Director so I gave them some lunch time talks on it and now they are quite interested. Wierdly, I left the scene and now my company wants me to write a demo for a set top box for a show in two weeks so I'm now
coding all day a demo for the silliest hardware in town. Weird world.

Chris
Challenge Trophies Won:

taj

Quote from: Jim on April 24, 2007

Also, VC2005 sees this loop...

char *dst = ...;
size_t size = ...;
int val = ...;
while (size--)
  *dst++ = val;

...and variations on it, and automatically optimizes that to

memset(dst, val, size);

which isn't very useful when you haven't linked in the C runtime!  Couldn't find an option to turn that off.  VC2005 likes generating these intrinsics wherever it can.

Jim


Yeah I faced that and got mad at the compiler. The solution is simple though, write the lopp backwards. Yes I know its more bytes but it works, the compiler is dumb enoyugh it cant spot the memcpy if the loop counts up ;-). Well VC++ Express version anyway.

Chris
Challenge Trophies Won:

Jim

The way I fixed it was to guarantee the size to be filled was a multiple of 4 (since it was 32bit pixels)
So I made it

char *dst = ...;
int *idst = (unsigned int *)dst;
size_t size = ...;
int val = ...;
val *= 0x01010101;
size>>=2;
while (size--)
  *idst++ = val;

Like you say, it's very stupid and it doesn't recognise that as 'rep stosd'.

Jim
Challenge Trophies Won:

benny!

Quote from: taj on April 24, 2007
Wll Im their Director so I gave them some lunch time talks on it and now they are quite interested.
Wierdly, I left the scene and now my company wants me to write a demo for a set top box for a
show in two weeks so I'm now coding all day a demo for the silliest hardware in town. Weird world.
...

Thats the weird way of life indeed, Chris ;) ... but with you they have the best man around to do
this job IMHO.


@taj+jim:
Neat tricks you talk about atm. Too much for my little brain right now. But very interesting !!!
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won: