diff options
author | mdodd <mdodd@FreeBSD.org> | 2003-01-15 02:02:33 +0000 |
---|---|---|
committer | mdodd <mdodd@FreeBSD.org> | 2003-01-15 02:02:33 +0000 |
commit | 3f76186ccea51c706ffda5d0f7d84b0c5185349d (patch) | |
tree | 27229aa69e5eda6f9bb25192716a669ab52288c1 | |
parent | 0fe7ecd1170afc5e85638da8cfa0e6b24ed25092 (diff) | |
download | FreeBSD-src-3f76186ccea51c706ffda5d0f7d84b0c5185349d.zip FreeBSD-src-3f76186ccea51c706ffda5d0f7d84b0c5185349d.tar.gz |
- Add inline functions for {ll,l,}abs() to libkern.
- Remove hand rolled abs() functions.
-rw-r--r-- | sys/dev/speaker/spkr.c | 11 | ||||
-rw-r--r-- | sys/i386/isa/spkr.c | 11 | ||||
-rw-r--r-- | sys/pc98/pc98/spkr.c | 11 | ||||
-rw-r--r-- | sys/sys/libkern.h | 4 |
4 files changed, 4 insertions, 33 deletions
diff --git a/sys/dev/speaker/spkr.c b/sys/dev/speaker/spkr.c index 4c8966e..de4c5ca 100644 --- a/sys/dev/speaker/spkr.c +++ b/sys/dev/speaker/spkr.c @@ -99,7 +99,6 @@ static void tone(unsigned int thz, unsigned int ticks); static void rest(int ticks); static void playinit(void); static void playtone(int pitch, int value, int sustain); -static int abs(int n); static void playstring(char *cp, size_t slen); /* emit tone of frequency thz for given number of ticks */ @@ -274,16 +273,6 @@ playtone(pitch, value, sustain) } } -static int -abs(n) - int n; -{ - if (n < 0) - return(-n); - else - return(n); -} - /* interpret and play an item from a notation string */ static void playstring(cp, slen) diff --git a/sys/i386/isa/spkr.c b/sys/i386/isa/spkr.c index 4c8966e..de4c5ca 100644 --- a/sys/i386/isa/spkr.c +++ b/sys/i386/isa/spkr.c @@ -99,7 +99,6 @@ static void tone(unsigned int thz, unsigned int ticks); static void rest(int ticks); static void playinit(void); static void playtone(int pitch, int value, int sustain); -static int abs(int n); static void playstring(char *cp, size_t slen); /* emit tone of frequency thz for given number of ticks */ @@ -274,16 +273,6 @@ playtone(pitch, value, sustain) } } -static int -abs(n) - int n; -{ - if (n < 0) - return(-n); - else - return(n); -} - /* interpret and play an item from a notation string */ static void playstring(cp, slen) diff --git a/sys/pc98/pc98/spkr.c b/sys/pc98/pc98/spkr.c index 2e4978c..3e3f437 100644 --- a/sys/pc98/pc98/spkr.c +++ b/sys/pc98/pc98/spkr.c @@ -86,7 +86,6 @@ static void tone(unsigned int thz, unsigned int ticks); static void rest(int ticks); static void playinit(void); static void playtone(int pitch, int value, int sustain); -static int abs(int n); static void playstring(char *cp, size_t slen); /* emit tone of frequency thz for given number of ticks */ @@ -282,16 +281,6 @@ playtone(pitch, value, sustain) } } -static int -abs(n) - int n; -{ - if (n < 0) - return(-n); - else - return(n); -} - /* interpret and play an item from a notation string */ static void playstring(cp, slen) diff --git a/sys/sys/libkern.h b/sys/sys/libkern.h index 65ab341..26947e1 100644 --- a/sys/sys/libkern.h +++ b/sys/sys/libkern.h @@ -63,6 +63,10 @@ static __inline quad_t qmin(quad_t a, quad_t b) { return (a < b ? a : b); } static __inline u_long ulmax(u_long a, u_long b) { return (a > b ? a : b); } static __inline u_long ulmin(u_long a, u_long b) { return (a < b ? a : b); } +static __inline int abs(int a) { return (((a) < 0) ? -(a) : (a)); } +static __inline long labs(long a) { return (((a) < 0) ? -(a) : (a)); } +static __inline long long llabs(long a) { return (((a) < 0) ? -(a) : (a)); } + /* Prototypes for non-quad routines. */ uint32_t arc4random(void); void arc4rand(void *ptr, u_int len, int reseed); |