Merge branch 'master' into rcce

This commit is contained in:
Stefan Lankes 2011-03-26 10:10:22 -07:00
commit 65d3c6c920
9 changed files with 67 additions and 145 deletions

View file

@ -34,14 +34,10 @@
/*
* The code has been taken from FreeBSD (sys/libkern/divdi3.c) and is therefore
* BSD-licensed. Unnecessary functions have been removed and all typedefs required
* have been added.
* have been added in quad.h.
*/
#include <metalsvm/stddef.h>
typedef int64_t quad_t;
typedef uint64_t u_quad_t;
u_quad_t __qdivrem(u_quad_t uq, u_quad_t vq, u_quad_t* arq);
#include "quad.h"
/*
* Divide two signed quads.

View file

@ -32,51 +32,12 @@
*/
/*
* The code has been taken from FreeBSD (sys/libkern/ucmpdi2.c) and is therefore
* The code has been taken from FreeBSD (sys/libkern/lshrdi3.c) and is therefore
* BSD-licensed. Unnecessary functions have been removed and all typedefs required
* have been added.
* have been added in quad.h.
*/
#include <metalsvm/stddef.h>
#define CHAR_BIT 8
#if BYTE_ORDER == LITTLE_ENDIAN
#define _QUAD_HIGHWORD 1
#define _QUAD_LOWWORD 0
#else
#define _QUAD_HIGHWORD 0
#define _QUAD_LOWWORD 1
#endif
/*
* Define high and low longwords.
*/
#define H _QUAD_HIGHWORD
#define L _QUAD_LOWWORD
/*
* Total number of bits in a quad_t and in the pieces that make it up.
* These are used for shifting, and also below for halfword extraction
* and assembly.
*/
#define QUAD_BITS (sizeof(quad_t) * CHAR_BIT)
#define LONG_BITS (sizeof(long) * CHAR_BIT)
#define HALF_BITS (sizeof(long) * CHAR_BIT / 2)
typedef int64_t quad_t;
typedef uint32_t qshift_t;
/*
* Depending on the desired operation, we view a `long long' (aka quad_t) in
* one or more of the following formats.
*/
union uu {
quad_t q; /* as a (signed) quad */
quad_t uq; /* as an unsigned quad */
int32_t sl[2]; /* as two signed longs */
uint32_t ul[2]; /* as two unsigned longs */
};
#include "quad.h"
/*
* Shift an (unsigned) quad value right (logical shift right).

View file

@ -34,14 +34,10 @@
/*
* The code has been taken from FreeBSD (sys/libkern/moddi3.c) and is therefore
* BSD-licensed. Unnecessary functions have been removed and all typedefs required
* have been added.
* have been added quad.h.
*/
#include <metalsvm/stddef.h>
typedef int64_t quad_t;
typedef uint64_t u_quad_t;
u_quad_t __qdivrem(u_quad_t uq, u_quad_t vq, u_quad_t* arq);
#include "quad.h"
/*
* Return remainder after dividing two signed quads.

View file

@ -34,7 +34,7 @@
/*
* The code has been taken from FreeBSD (sys/libkern/qdivrem.c) and is therefore
* BSD-licensed. Unnecessary functions have been removed and all typedefs required
* have been added.
* have been added in quad.h.
*/
/*
@ -43,48 +43,7 @@
*/
/* MetalSVM prelude */
#include <metalsvm/stddef.h>
#include <asm/limits.h>
typedef uint64_t u_quad_t;
typedef int64_t quad_t;
typedef uint32_t u_long;
/*
* Depending on the desired operation, we view a `long long' (aka quad_t) in
* one or more of the following formats.
*/
union uu {
quad_t q; /* as a (signed) quad */
quad_t uq; /* as an unsigned quad */
int32_t sl[2]; /* as two signed longs */
uint32_t ul[2]; /* as two unsigned longs */
};
#define CHAR_BIT 8
#if BYTE_ORDER == LITTLE_ENDIAN
#define _QUAD_HIGHWORD 1
#define _QUAD_LOWWORD 0
#else
#define _QUAD_HIGHWORD 0
#define _QUAD_LOWWORD 1
#endif
/*
* Define high and low longwords.
*/
#define H _QUAD_HIGHWORD
#define L _QUAD_LOWWORD
/*
* Total number of bits in a quad_t and in the pieces that make it up.
* These are used for shifting, and also below for halfword extraction
* and assembly.
*/
#define QUAD_BITS (sizeof(quad_t) * CHAR_BIT)
#define LONG_BITS (sizeof(long) * CHAR_BIT)
#define HALF_BITS (sizeof(long) * CHAR_BIT / 2)
#include "quad.h"
/*
* Extract high and low shortwords from longword, and move low shortword of

51
libkern/quad.h Normal file
View file

@ -0,0 +1,51 @@
#ifndef __QUAD_H__
#define __QUAD_H__
/* MetalSVM prelude */
#include <metalsvm/stddef.h>
#include <asm/limits.h>
typedef uint64_t u_quad_t;
typedef int64_t quad_t;
typedef uint32_t u_long;
typedef uint32_t qshift_t;
/*
* Depending on the desired operation, we view a `long long' (aka quad_t) in
* one or more of the following formats.
*/
union uu {
quad_t q; /* as a (signed) quad */
quad_t uq; /* as an unsigned quad */
int32_t sl[2]; /* as two signed longs */
uint32_t ul[2]; /* as two unsigned longs */
};
#define CHAR_BIT 8
#if BYTE_ORDER == LITTLE_ENDIAN
#define _QUAD_HIGHWORD 1
#define _QUAD_LOWWORD 0
#else
#define _QUAD_HIGHWORD 0
#define _QUAD_LOWWORD 1
#endif
/*
* Define high and low longwords.
*/
#define H _QUAD_HIGHWORD
#define L _QUAD_LOWWORD
/*
* Total number of bits in a quad_t and in the pieces that make it up.
* These are used for shifting, and also below for halfword extraction
* and assembly.
*/
#define QUAD_BITS (sizeof(quad_t) * CHAR_BIT)
#define LONG_BITS (sizeof(long) * CHAR_BIT)
#define HALF_BITS (sizeof(long) * CHAR_BIT / 2)
u_quad_t __qdivrem(u_quad_t uq, u_quad_t vq, u_quad_t* arq);
#endif

View file

@ -33,13 +33,7 @@
*/
/*
* The code has been taken from FreeBSD (sys/libkern/qdivrem.c) and is therefore
* BSD-licensed. Unnecessary functions have been removed and all typedefs required
* have been added.
*/
/*
* The code has been taken from FreeBSD (sys/libkern/qdivrem.c) and is therefore
* The code has been taken from FreeBSD (sys/libkern/strtol.c) and is therefore
* BSD-licensed. Unnecessary functions have been removed and all typedefs required
* have been added.
*/

View file

@ -34,38 +34,10 @@
/*
* The code has been taken from FreeBSD (sys/libkern/ucmpdi2.c) and is therefore
* BSD-licensed. Unnecessary functions have been removed and all typedefs required
* have been added.
* have been added quad.h.
*/
#include <metalsvm/stddef.h>
#if BYTE_ORDER == LITTLE_ENDIAN
#define _QUAD_HIGHWORD 1
#define _QUAD_LOWWORD 0
#else
#define _QUAD_HIGHWORD 0
#define _QUAD_LOWWORD 1
#endif
/*
* Define high and low longwords.
*/
#define H _QUAD_HIGHWORD
#define L _QUAD_LOWWORD
typedef int64_t quad_t;
typedef uint64_t u_quad_t;
/*
* Depending on the desired operation, we view a `long long' (aka quad_t) in
* one or more of the following formats.
*/
union uu {
quad_t q; /* as a (signed) quad */
quad_t uq; /* as an unsigned quad */
int32_t sl[2]; /* as two signed longs */
uint32_t ul[2]; /* as two unsigned longs */
};
#include "quad.h"
/*
* Return 0, 1, or 2 as a <, =, > b respectively.

View file

@ -34,13 +34,10 @@
/*
* The code has been taken from FreeBSD (sys/libkern/udivdi3.c) and is therefore
* BSD-licensed. Unnecessary functions have been removed and all typedefs required
* have been added.
* have been added in quad.h.
*/
#include <metalsvm/stddef.h>
typedef uint64_t u_quad_t;
u_quad_t __qdivrem(u_quad_t uq, u_quad_t vq, u_quad_t* arq);
#include "quad.h"
/*
* Divide two unsigned quads.

View file

@ -34,14 +34,10 @@
/*
* The code has been taken from FreeBSD (sys/libkern/umoddi3.c) and is therefore
* BSD-licensed. Unnecessary functions have been removed and all typedefs required
* have been added.
* have been added in quad.h.
*/
#include <metalsvm/stddef.h>
typedef uint64_t u_quad_t;
u_quad_t __qdivrem(u_quad_t uq, u_quad_t vq, u_quad_t* arq);
#include "quad.h"
/*
* Return remainder after dividing two unsigned quads.