ANSIfy sys/libkern
PR: 223641 Submitted by: ota@j.email.ne.jp MFC after: 1 week
This commit is contained in:
parent
dab900583d
commit
4a8dea8cf9
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=325988
@ -40,9 +40,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
* Shift a (signed) quad value right (arithmetic shift right).
|
* Shift a (signed) quad value right (arithmetic shift right).
|
||||||
*/
|
*/
|
||||||
quad_t
|
quad_t
|
||||||
__ashrdi3(a, shift)
|
__ashrdi3(quad_t a, qshift_t shift)
|
||||||
quad_t a;
|
|
||||||
qshift_t shift;
|
|
||||||
{
|
{
|
||||||
union uu aa;
|
union uu aa;
|
||||||
|
|
||||||
|
@ -42,9 +42,7 @@ typedef const unsigned long *culp;
|
|||||||
* bcmp -- vax cmpc3 instruction
|
* bcmp -- vax cmpc3 instruction
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
bcmp(b1, b2, length)
|
bcmp(const void *b1, const void *b2, size_t length)
|
||||||
const void *b1, *b2;
|
|
||||||
size_t length;
|
|
||||||
{
|
{
|
||||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||||
/*
|
/*
|
||||||
|
@ -53,12 +53,8 @@ __FBSDID("$FreeBSD$");
|
|||||||
* look at item 3.
|
* look at item 3.
|
||||||
*/
|
*/
|
||||||
void *
|
void *
|
||||||
bsearch(key, base0, nmemb, size, compar)
|
bsearch(const void *key, const void *base0, size_t nmemb, size_t size,
|
||||||
const void *key;
|
int (*compar)(const void *, const void *))
|
||||||
const void *base0;
|
|
||||||
size_t nmemb;
|
|
||||||
size_t size;
|
|
||||||
int (*compar)(const void *, const void *);
|
|
||||||
{
|
{
|
||||||
const char *base = base0;
|
const char *base = base0;
|
||||||
size_t lim;
|
size_t lim;
|
||||||
|
@ -42,8 +42,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
* signed.
|
* signed.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
__cmpdi2(a, b)
|
__cmpdi2(quad_t a, quad_t b)
|
||||||
quad_t a, b;
|
|
||||||
{
|
{
|
||||||
union uu aa, bb;
|
union uu aa, bb;
|
||||||
|
|
||||||
|
@ -41,8 +41,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
* ??? if -1/2 should produce -1 on this machine, this code is wrong
|
* ??? if -1/2 should produce -1 on this machine, this code is wrong
|
||||||
*/
|
*/
|
||||||
quad_t
|
quad_t
|
||||||
__divdi3(a, b)
|
__divdi3(quad_t a, quad_t b)
|
||||||
quad_t a, b;
|
|
||||||
{
|
{
|
||||||
u_quad_t ua, ub, uq;
|
u_quad_t ua, ub, uq;
|
||||||
int neg;
|
int neg;
|
||||||
|
@ -40,9 +40,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
* Shift an (unsigned) quad value right (logical shift right).
|
* Shift an (unsigned) quad value right (logical shift right).
|
||||||
*/
|
*/
|
||||||
quad_t
|
quad_t
|
||||||
__lshrdi3(a, shift)
|
__lshrdi3(quad_t a, qshift_t shift)
|
||||||
quad_t a;
|
|
||||||
qshift_t shift;
|
|
||||||
{
|
{
|
||||||
union uu aa;
|
union uu aa;
|
||||||
|
|
||||||
|
@ -56,8 +56,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
* both frompcindex and frompc. Any reasonable, modern compiler will
|
* both frompcindex and frompc. Any reasonable, modern compiler will
|
||||||
* perform this optimization.
|
* perform this optimization.
|
||||||
*/
|
*/
|
||||||
_MCOUNT_DECL(frompc, selfpc) /* _mcount; may be static, inline, etc */
|
_MCOUNT_DECL(uintfptr_t frompc, uintfptr_t selfpc) /* _mcount; may be static, inline, etc */
|
||||||
uintfptr_t frompc, selfpc;
|
|
||||||
{
|
{
|
||||||
#ifdef GUPROF
|
#ifdef GUPROF
|
||||||
int delta;
|
int delta;
|
||||||
@ -245,8 +244,7 @@ MCOUNT
|
|||||||
|
|
||||||
#ifdef GUPROF
|
#ifdef GUPROF
|
||||||
void
|
void
|
||||||
mexitcount(selfpc)
|
mexitcount(uintfptr_t selfpc)
|
||||||
uintfptr_t selfpc;
|
|
||||||
{
|
{
|
||||||
struct gmonparam *p;
|
struct gmonparam *p;
|
||||||
uintfptr_t selfpcdiff;
|
uintfptr_t selfpcdiff;
|
||||||
|
@ -43,8 +43,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
* If -1/2 should produce -1 on this machine, this code is wrong.
|
* If -1/2 should produce -1 on this machine, this code is wrong.
|
||||||
*/
|
*/
|
||||||
quad_t
|
quad_t
|
||||||
__moddi3(a, b)
|
__moddi3(quad_t a, quad_t b)
|
||||||
quad_t a, b;
|
|
||||||
{
|
{
|
||||||
u_quad_t ua, ub, ur;
|
u_quad_t ua, ub, ur;
|
||||||
int neg;
|
int neg;
|
||||||
|
@ -77,8 +77,7 @@ __shl(digit *p, int len, int sh)
|
|||||||
* leading zeros).
|
* leading zeros).
|
||||||
*/
|
*/
|
||||||
u_quad_t
|
u_quad_t
|
||||||
__qdivrem(uq, vq, arq)
|
__qdivrem(u_quad_t uq, u_quad_t vq, u_quad_t *arq)
|
||||||
u_quad_t uq, vq, *arq;
|
|
||||||
{
|
{
|
||||||
union uu tmp;
|
union uu tmp;
|
||||||
digit *u, *v, *q;
|
digit *u, *v, *q;
|
||||||
|
@ -39,8 +39,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
static u_long randseed = 937186357; /* after srandom(1), NSHUFF counted */
|
static u_long randseed = 937186357; /* after srandom(1), NSHUFF counted */
|
||||||
|
|
||||||
void
|
void
|
||||||
srandom(seed)
|
srandom(u_long seed)
|
||||||
u_long seed;
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -35,10 +35,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <sys/libkern.h>
|
#include <sys/libkern.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
scanc(size, cp, table, mask0)
|
scanc(u_int size, const u_char *cp, const u_char table[], int mask0)
|
||||||
u_int size;
|
|
||||||
const u_char *cp, table[];
|
|
||||||
int mask0;
|
|
||||||
{
|
{
|
||||||
const u_char *end;
|
const u_char *end;
|
||||||
u_char mask;
|
u_char mask;
|
||||||
|
@ -39,8 +39,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
* Compare strings.
|
* Compare strings.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
strcmp(s1, s2)
|
strcmp(const char *s1, const char *s2)
|
||||||
const char *s1, *s2;
|
|
||||||
{
|
{
|
||||||
while (*s1 == *s2++)
|
while (*s1 == *s2++)
|
||||||
if (*s1++ == 0)
|
if (*s1++ == 0)
|
||||||
|
@ -44,10 +44,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
* If retval >= siz, truncation occurred.
|
* If retval >= siz, truncation occurred.
|
||||||
*/
|
*/
|
||||||
size_t
|
size_t
|
||||||
strlcat(dst, src, siz)
|
strlcat(char *dst, const char *src, size_t siz)
|
||||||
char *dst;
|
|
||||||
const char *src;
|
|
||||||
size_t siz;
|
|
||||||
{
|
{
|
||||||
char *d = dst;
|
char *d = dst;
|
||||||
const char *s = src;
|
const char *s = src;
|
||||||
|
@ -48,9 +48,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
* If *stringp is NULL, strsep returns NULL.
|
* If *stringp is NULL, strsep returns NULL.
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
strsep(stringp, delim)
|
strsep(char **stringp, const char *delim)
|
||||||
char **stringp;
|
|
||||||
const char *delim;
|
|
||||||
{
|
{
|
||||||
char *s;
|
char *s;
|
||||||
const char *spanp;
|
const char *spanp;
|
||||||
|
@ -47,10 +47,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
* alphabets and digits are each contiguous.
|
* alphabets and digits are each contiguous.
|
||||||
*/
|
*/
|
||||||
long
|
long
|
||||||
strtol(nptr, endptr, base)
|
strtol(const char *nptr, char **endptr, int base)
|
||||||
const char *nptr;
|
|
||||||
char **endptr;
|
|
||||||
int base;
|
|
||||||
{
|
{
|
||||||
const char *s = nptr;
|
const char *s = nptr;
|
||||||
unsigned long acc;
|
unsigned long acc;
|
||||||
|
@ -47,10 +47,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
* alphabets and digits are each contiguous.
|
* alphabets and digits are each contiguous.
|
||||||
*/
|
*/
|
||||||
unsigned long
|
unsigned long
|
||||||
strtoul(nptr, endptr, base)
|
strtoul(const char *nptr, char **endptr, int base)
|
||||||
const char *nptr;
|
|
||||||
char **endptr;
|
|
||||||
int base;
|
|
||||||
{
|
{
|
||||||
const char *s = nptr;
|
const char *s = nptr;
|
||||||
unsigned long acc;
|
unsigned long acc;
|
||||||
|
@ -41,8 +41,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
* Neither a nor b are considered signed.
|
* Neither a nor b are considered signed.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
__ucmpdi2(a, b)
|
__ucmpdi2(u_quad_t a, u_quad_t b)
|
||||||
u_quad_t a, b;
|
|
||||||
{
|
{
|
||||||
union uu aa, bb;
|
union uu aa, bb;
|
||||||
|
|
||||||
|
@ -40,8 +40,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
* Divide two unsigned quads.
|
* Divide two unsigned quads.
|
||||||
*/
|
*/
|
||||||
u_quad_t
|
u_quad_t
|
||||||
__udivdi3(a, b)
|
__udivdi3(u_quad_t a, u_quad_t b)
|
||||||
u_quad_t a, b;
|
|
||||||
{
|
{
|
||||||
|
|
||||||
return (__qdivrem(a, b, (u_quad_t *)0));
|
return (__qdivrem(a, b, (u_quad_t *)0));
|
||||||
|
@ -40,8 +40,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
* Return remainder after dividing two unsigned quads.
|
* Return remainder after dividing two unsigned quads.
|
||||||
*/
|
*/
|
||||||
u_quad_t
|
u_quad_t
|
||||||
__umoddi3(a, b)
|
__umoddi3(u_quad_t a, u_quad_t b)
|
||||||
u_quad_t a, b;
|
|
||||||
{
|
{
|
||||||
u_quad_t r;
|
u_quad_t r;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user