72 lines
2.9 KiB
C
72 lines
2.9 KiB
C
|
/*-
|
||
|
* Copyright (c) 1992, 1993
|
||
|
* The Regents of the University of California. All rights reserved.
|
||
|
*
|
||
|
* This software was developed by the Computer Systems Engineering group
|
||
|
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
|
||
|
* contributed to Berkeley.
|
||
|
*
|
||
|
* Redistribution and use in source and binary forms, with or without
|
||
|
* modification, are permitted provided that the following conditions
|
||
|
* are met:
|
||
|
* 1. Redistributions of source code must retain the above copyright
|
||
|
* notice, this list of conditions and the following disclaimer.
|
||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||
|
* notice, this list of conditions and the following disclaimer in the
|
||
|
* documentation and/or other materials provided with the distribution.
|
||
|
* 4. Neither the name of the University nor the names of its contributors
|
||
|
* may be used to endorse or promote products derived from this software
|
||
|
* without specific prior written permission.
|
||
|
*
|
||
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||
|
* SUCH DAMAGE.
|
||
|
*
|
||
|
* @(#)quad.h 8.1 (Berkeley) 6/4/93
|
||
|
* $FreeBSD$
|
||
|
*/
|
||
|
/* Derived from FreeBDS libkern quad.h, munged by Erbo to COMROGUE standards */
|
||
|
#ifndef QUAD_H_INCLUDED
|
||
|
#define QUAD_H_INCLUDED
|
||
|
|
||
|
#include <comrogue/types.h>
|
||
|
|
||
|
typedef union tagUU {
|
||
|
INT64 q; /* signed quad */
|
||
|
UINT64 uq; /* unsigned quad */
|
||
|
INT32 sl[2]; /* two signed longs */
|
||
|
UINT32 ul[2]; /* two unsigned longs */
|
||
|
} UU;
|
||
|
|
||
|
/* Low word/high word definitions. */
|
||
|
#define L 0
|
||
|
#define H 1
|
||
|
|
||
|
/* Number of bits in a halfword. */
|
||
|
#define HALF_BITS (INT32_BITS / 2)
|
||
|
|
||
|
/*
|
||
|
* Extract high and low shortwords from longword, and move low shortword of
|
||
|
* longword to upper half of long, i.e., produce the upper longword of
|
||
|
* ((quad_t)(x) << (number_of_bits_in_long/2)). (`x' must actually be u_long.)
|
||
|
*
|
||
|
* These are used in the multiply code, to split a longword into upper
|
||
|
* and lower halves, and to reassemble a product as a quad_t, shifted left
|
||
|
* (sizeof(long)*CHAR_BIT/2).
|
||
|
*/
|
||
|
#define HHALF(x) ((x) >> HALF_BITS)
|
||
|
#define LHALF(x) ((x) & ((1 << HALF_BITS) - 1))
|
||
|
#define LHUP(x) ((x) << HALF_BITS)
|
||
|
|
||
|
extern UINT64 __qdivrem(UINT64 u, UINT64 v, PUINT64 pRem);
|
||
|
|
||
|
#endif /* QUAD_H_INCLUDED */
|