Author Topic: 1k Trinity no ordinals  (Read 11723 times)

0 Members and 1 Guest are viewing this topic.

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1668
  • Karma: 133
    • View Profile
Re: 1k Trinity no ordinals
« Reply #20 on: April 24, 2007 »
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:

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: 1k Trinity no ordinals
« Reply #21 on: April 24, 2007 »
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:

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: 1k Trinity no ordinals
« Reply #22 on: April 24, 2007 »

Also, VC2005 sees this loop...
Code: [Select]
char *dst = ...;
size_t size = ...;
int val = ...;
while (size--)
  *dst++ = val;
...and variations on it, and automatically optimizes that to
Code: [Select]
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:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: 1k Trinity no ordinals
« Reply #23 on: April 25, 2007 »
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
Code: [Select]
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:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: 1k Trinity no ordinals
« Reply #24 on: April 25, 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: