Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/rasops In rasops_copy{rows, cols}(), if src == dst, w...



details:   https://anonhg.NetBSD.org/src/rev/6c7a9d519d53
branches:  trunk
changeset: 458108:6c7a9d519d53
user:      rin <rin%NetBSD.org@localhost>
date:      Tue Jul 30 14:41:10 2019 +0000

description:
In rasops_copy{rows,cols}(), if src == dst, we have nothing to do.
Otherwise, we can use memcpy safely instead of memmove.

diffstat:

 sys/dev/rasops/rasops.c |  16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diffs (62 lines):

diff -r e4b49e3939a0 -r 6c7a9d519d53 sys/dev/rasops/rasops.c
--- a/sys/dev/rasops/rasops.c   Tue Jul 30 14:33:04 2019 +0000
+++ b/sys/dev/rasops/rasops.c   Tue Jul 30 14:41:10 2019 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: rasops.c,v 1.99 2019/07/30 14:33:04 rin Exp $ */
+/*      $NetBSD: rasops.c,v 1.100 2019/07/30 14:41:10 rin Exp $        */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.99 2019/07/30 14:33:04 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.100 2019/07/30 14:41:10 rin Exp $");
 
 #include "opt_rasops.h"
 #include "rasops_glue.h"
@@ -675,10 +675,10 @@
 
        hp = NULL;      /* XXX GCC */
 
-#ifdef RASOPS_CLIPPING
-       if (dst == src)
+       if (__predict_false(dst == src))
                return;
 
+#ifdef RASOPS_CLIPPING
        if (src < 0) {
                num += src;
                src = 0;
@@ -709,7 +709,7 @@
                hp = ri->ri_hwbits + dst * ri->ri_yscale;
 
        while (num--) {
-               memmove(dp, sp, n);
+               memcpy(dp, sp, n);
                dp += stride;
                if (ri->ri_hwbits) {
                        memcpy(hp, sp, n);
@@ -734,10 +734,10 @@
 
        hp = NULL;      /* XXX GCC */
 
-#ifdef RASOPS_CLIPPING
-       if (dst == src)
+       if (__predict_false(dst == src))
                return;
 
+#ifdef RASOPS_CLIPPING
        /* Catches < 0 case too */
        if ((unsigned)row >= (unsigned)ri->ri_rows)
                return;
@@ -772,7 +772,7 @@
                hp = ri->ri_hwbits + row + dst * ri->ri_xscale;
 
        while (height--) {
-               memmove(dp, sp, num);
+               memcpy(dp, sp, num);
                dp += ri->ri_stride;
                if (ri->ri_hwbits) {
                        memcpy(hp, sp, num);



Home | Main Index | Thread Index | Old Index