Source-Changes-HG archive

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

[src/trunk]: src/sys/lib/libkern Provide labs, llabs and imaxabs for kernel use.



details:   https://anonhg.NetBSD.org/src/rev/db5b1974cd37
branches:  trunk
changeset: 793854:db5b1974cd37
user:      joerg <joerg%NetBSD.org@localhost>
date:      Thu Feb 27 18:05:07 2014 +0000

description:
Provide labs, llabs and imaxabs for kernel use.

diffstat:

 sys/lib/libkern/libkern.h |  23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diffs (44 lines):

diff -r 6a0eec87ed3c -r db5b1974cd37 sys/lib/libkern/libkern.h
--- a/sys/lib/libkern/libkern.h Thu Feb 27 18:01:51 2014 +0000
+++ b/sys/lib/libkern/libkern.h Thu Feb 27 18:05:07 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: libkern.h,v 1.112 2013/12/27 20:25:33 christos Exp $   */
+/*     $NetBSD: libkern.h,v 1.113 2014/02/27 18:05:07 joerg Exp $      */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -52,6 +52,9 @@
 LIBKERN_INLINE u_long ulmax(u_long, u_long) __unused;
 LIBKERN_INLINE u_long ulmin(u_long, u_long) __unused;
 LIBKERN_INLINE int abs(int) __unused;
+LIBKERN_INLINE long labs(long) __unused;
+LIBKERN_INLINE long long llabs(long long) __unused;
+LIBKERN_INLINE intmax_t imaxabs(intmax_t) __unused;
 
 LIBKERN_INLINE int isspace(int) __unused;
 LIBKERN_INLINE int isascii(int) __unused;
@@ -111,6 +114,24 @@
        return(j < 0 ? -j : j);
 }
 
+LIBKERN_INLINE long
+labs(long j)
+{
+       return(j < 0 ? -j : j);
+}
+
+LIBKERN_INLINE long long
+llabs(long long j)
+{
+       return(j < 0 ? -j : j);
+}
+
+LIBKERN_INLINE intmax_t
+imaxabs(intmax_t j)
+{
+       return(j < 0 ? -j : j);
+}
+
 LIBKERN_INLINE int
 isspace(int ch)
 {



Home | Main Index | Thread Index | Old Index