From 2afd09b9e132898cce7c1f0e33bc3b1e8bc6ee3a Mon Sep 17 00:00:00 2001 From: Tomas Lindquist Olsen Date: Mon, 5 May 2008 22:20:07 +0200 Subject: [PATCH] [svn r181] Updated the raytracer demo by downs to work with tango :) My quick benchmarking shows it to be around 65% faster than DMD :D --- demos/ray.d | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/demos/ray.d b/demos/ray.d index c896f861..c949dbd4 100644 --- a/demos/ray.d +++ b/demos/ray.d @@ -1,4 +1,6 @@ -import std.stdio; +import tango.stdc.stdio; + +alias char[] string; int atoi(char[] s) { int i, fac=1; @@ -11,8 +13,15 @@ int atoi(char[] s) { return !neg ? i : -i; } +version(LLVMDC) +{ pragma(LLVM_internal, "intrinsic", "llvm.sqrt.f64") double sqrt(double val); +} +else +{ + import tango.stdc.math; +} double delta; static this() { delta=sqrt(real.epsilon); } @@ -104,13 +113,13 @@ void main(string[] args) { n = (args.length==3 ? args[2].atoi() : 512), ss = 4; auto light = Vec(-1, -3, 2).unitise(); auto s=create(level, Vec(0, -1, 0), 1); - writefln("P5\n", n, " ", n, "\n255"); + printf("P5\n%d %d\n255", n,n); for (int y=n-1; y>=0; --y) for (int x=0; x