Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/games/battlestar avoid unnecessary floating point ops



details:   https://anonhg.NetBSD.org/src/rev/29287c558a80
branches:  trunk
changeset: 794727:29287c558a80
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sat Mar 22 23:31:28 2014 +0000

description:
avoid unnecessary floating point ops

diffstat:

 games/battlestar/command5.c |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (34 lines):

diff -r 079080b171f9 -r 29287c558a80 games/battlestar/command5.c
--- a/games/battlestar/command5.c       Sat Mar 22 23:23:55 2014 +0000
+++ b/games/battlestar/command5.c       Sat Mar 22 23:31:28 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: command5.c,v 1.4 2012/06/19 05:46:08 dholland Exp $    */
+/*     $NetBSD: command5.c,v 1.5 2014/03/22 23:31:28 dholland Exp $    */
 
 /*
  * Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)com5.c     8.2 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: command5.c,v 1.4 2012/06/19 05:46:08 dholland Exp $");
+__RCSID("$NetBSD: command5.c,v 1.5 2014/03/22 23:31:28 dholland Exp $");
 #endif
 #endif                         /* not lint */
 
@@ -186,10 +186,13 @@
 {
        int     oldtime;
        int     n;
+       int zzztime;
+
+       zzztime = (3 * CYCLE) / 4;
 
        oldtime = ourtime;
-       if ((snooze - ourtime) < (0.75 * CYCLE)) {
-               ourtime += 0.75 * CYCLE - (snooze - ourtime);
+       if ((snooze - ourtime) < zzztime) {
+               ourtime += zzztime - (snooze - ourtime);
                printf("<zzz>");
                for (n = 0; n < ourtime - oldtime; n++)
                        printf(".");



Home | Main Index | Thread Index | Old Index