Source-Changes-HG archive

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

[src/trunk]: src/common/lib/libc/atomic Fix return value. or_and_fetch shoul...



details:   https://anonhg.NetBSD.org/src/rev/2c6040b4d88a
branches:  trunk
changeset: 839644:2c6040b4d88a
user:      isaki <isaki%NetBSD.org@localhost>
date:      Fri Mar 01 09:57:32 2019 +0000

description:
Fix return value.  or_and_fetch should return new value.

diffstat:

 common/lib/libc/atomic/atomic_or_16_cas.c |  4 ++--
 common/lib/libc/atomic/atomic_or_8_cas.c  |  4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r dcdaa6554e76 -r 2c6040b4d88a common/lib/libc/atomic/atomic_or_16_cas.c
--- a/common/lib/libc/atomic/atomic_or_16_cas.c Fri Mar 01 09:25:59 2019 +0000
+++ b/common/lib/libc/atomic/atomic_or_16_cas.c Fri Mar 01 09:57:32 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atomic_or_16_cas.c,v 1.3 2014/06/23 21:53:45 joerg Exp $       */
+/*     $NetBSD: atomic_or_16_cas.c,v 1.4 2019/03/01 09:57:32 isaki Exp $       */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
                old = *addr;
                new = old | val;
        } while (atomic_cas_16(addr, old, new) != old);
-       return old;
+       return new;
 }
 
 __strong_alias(__atomic_fetch_or_2,__sync_fetch_and_or_2)
diff -r dcdaa6554e76 -r 2c6040b4d88a common/lib/libc/atomic/atomic_or_8_cas.c
--- a/common/lib/libc/atomic/atomic_or_8_cas.c  Fri Mar 01 09:25:59 2019 +0000
+++ b/common/lib/libc/atomic/atomic_or_8_cas.c  Fri Mar 01 09:57:32 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atomic_or_8_cas.c,v 1.3 2014/06/23 21:53:45 joerg Exp $        */
+/*     $NetBSD: atomic_or_8_cas.c,v 1.4 2019/03/01 09:57:32 isaki Exp $        */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
                old = *addr;
                new = old | val;
        } while (atomic_cas_8(addr, old, new) != old);
-       return old;
+       return new;
 }
 
 __strong_alias(__atomic_fetch_or_1,__sync_fetch_and_or_1)



Home | Main Index | Thread Index | Old Index