Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/hpc G/c static pow() function that was used to calcu...



details:   https://anonhg.NetBSD.org/src/rev/f9b2b36d5273
branches:  trunk
changeset: 537534:f9b2b36d5273
user:      reinoud <reinoud%NetBSD.org@localhost>
date:      Wed Oct 02 10:43:06 2002 +0000

description:
G/c static pow() function that was used to calculate (2^x) only; replaced
the two instances with equivalent (1<<x).

diffstat:

 sys/dev/hpc/hpcfb.c |  21 +++++----------------
 1 files changed, 5 insertions(+), 16 deletions(-)

diffs (68 lines):

diff -r ca2c7ac0d0d5 -r f9b2b36d5273 sys/dev/hpc/hpcfb.c
--- a/sys/dev/hpc/hpcfb.c       Wed Oct 02 10:42:34 2002 +0000
+++ b/sys/dev/hpc/hpcfb.c       Wed Oct 02 10:43:06 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hpcfb.c,v 1.25 2002/09/30 21:09:35 thorpej Exp $       */
+/*     $NetBSD: hpcfb.c,v 1.26 2002/10/02 10:43:06 reinoud Exp $       */
 
 /*-
  * Copyright (c) 1999
@@ -43,13 +43,13 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hpcfb.c,v 1.25 2002/09/30 21:09:35 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpcfb.c,v 1.26 2002/10/02 10:43:06 reinoud Exp $");
 
 #define FBDEBUG
 static const char _copyright[] __attribute__ ((unused)) =
     "Copyright (c) 1999 Shin Takemura.  All rights reserved.";
 static const char _rcsid[] __attribute__ ((unused)) =
-    "$NetBSD: hpcfb.c,v 1.25 2002/09/30 21:09:35 thorpej Exp $";
+    "$NetBSD: hpcfb.c,v 1.26 2002/10/02 10:43:06 reinoud Exp $";
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -204,8 +204,6 @@
 static void    hpcfb_cmap_reorder(struct hpcfb_fbconf *,
                    struct hpcfb_devconfig *);
 
-static int     pow(int, int);
-
 void    hpcfb_cursor(void *, int, int, int);
 int     hpcfb_mapchar(void *, int, unsigned int *);
 void    hpcfb_putchar(void *, int, int, u_int, long);
@@ -284,15 +282,6 @@
 /*
  *  function bodies
  */
-static int
-pow(int x, int n)
-{
-       int res = 1;
-       while (0 < n--) {
-               res *= x;
-       }
-       return (res);
-}
 
 int
 hpcfbmatch(struct device *parent, struct cfdata *match, void *aux)
@@ -317,7 +306,7 @@
                hpcfb_console_dc.dc_sc = sc;
                printf(": %dx%d pixels, %d colors, %dx%d chars",
                    sc->sc_dc->dc_rinfo.ri_width,sc->sc_dc->dc_rinfo.ri_height,
-                   pow(2, sc->sc_dc->dc_rinfo.ri_depth),
+                   (1 << sc->sc_dc->dc_rinfo.ri_depth),
                    sc->sc_dc->dc_rinfo.ri_cols,sc->sc_dc->dc_rinfo.ri_rows);
                /* Set video chip dependent CLUT if any. */
                if (sc->sc_accessops->setclut)
@@ -727,7 +716,7 @@
                sc->sc_accessops->setclut(sc->sc_accessctx, &dc->dc_rinfo);
        printf("hpcfb: %dx%d pixels, %d colors, %dx%d chars\n",
            dc->dc_rinfo.ri_width, dc->dc_rinfo.ri_height,
-           pow(2, dc->dc_rinfo.ri_depth),
+           (1 << dc->dc_rinfo.ri_depth),
            dc->dc_rinfo.ri_cols, dc->dc_rinfo.ri_rows);
 
        /*



Home | Main Index | Thread Index | Old Index