1*ce099b40Smartin /*	$NetBSD: atomic_dec_64_add.c,v 1.4 2008/04/28 20:22:52 martin Exp $	*/
279085586Sad 
379085586Sad /*-
479085586Sad  * Copyright (c) 2007 The NetBSD Foundation, Inc.
579085586Sad  * All rights reserved.
679085586Sad  *
779085586Sad  * This code is derived from software contributed to The NetBSD Foundation
879085586Sad  * by Jason R. Thorpe.
979085586Sad  *
1079085586Sad  * Redistribution and use in source and binary forms, with or without
1179085586Sad  * modification, are permitted provided that the following conditions
1279085586Sad  * are met:
1379085586Sad  * 1. Redistributions of source code must retain the above copyright
1479085586Sad  *    notice, this list of conditions and the following disclaimer.
1579085586Sad  * 2. Redistributions in binary form must reproduce the above copyright
1679085586Sad  *    notice, this list of conditions and the following disclaimer in the
1779085586Sad  *    documentation and/or other materials provided with the distribution.
1879085586Sad  *
1979085586Sad  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
2079085586Sad  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
2179085586Sad  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2279085586Sad  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
2379085586Sad  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2479085586Sad  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2579085586Sad  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2679085586Sad  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2779085586Sad  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2879085586Sad  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2979085586Sad  * POSSIBILITY OF SUCH DAMAGE.
3079085586Sad  */
3179085586Sad 
3279085586Sad #include "atomic_op_namespace.h"
3379085586Sad 
3479085586Sad #include <sys/atomic.h>
3579085586Sad 
36695c2bc2Sad #ifdef __HAVE_ATOMIC64_OPS
37695c2bc2Sad 
3879085586Sad void
atomic_dec_64(volatile uint64_t * addr)3979085586Sad atomic_dec_64(volatile uint64_t *addr)
4079085586Sad {
4179085586Sad 
4279085586Sad 	atomic_add_64(addr, -1);
4379085586Sad }
4479085586Sad 
4579085586Sad #undef atomic_dec_64
4679085586Sad atomic_op_alias(atomic_dec_64,_atomic_dec_64)
4779085586Sad #if defined(_LP64)
4879085586Sad #undef atomic_dec_ulong
4979085586Sad atomic_op_alias(atomic_dec_ulong,_atomic_dec_64)
5079085586Sad __strong_alias(_atomic_dec_ulong,_atomic_dec_64)
5179085586Sad #undef atomic_dec_ptr
5279085586Sad atomic_op_alias(atomic_dec_ptr,_atomic_dec_64)
5379085586Sad __strong_alias(_atomic_dec_ptr,_atomic_dec_64)
5479085586Sad #endif /* _LP64 */
55695c2bc2Sad 
56695c2bc2Sad #endif
57