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/8e57c3757af5
branches:  trunk
changeset: 449273:8e57c3757af5
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 fddda59dd087 -r 8e57c3757af5 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 fddda59dd087 -r 8e57c3757af5 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