Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids. Most
[dragonfly.git] / sys / boot / ficl / math64.h
1 /*******************************************************************
2 ** m a t h 6 4 . h
3 ** Forth Inspired Command Language - 64 bit math support routines
4 ** Author: John Sadler (john_sadler@alum.mit.edu)
5 ** Created: 25 January 1998
6 ** 
7 *******************************************************************/
8 /*
9 ** N O T I C E -- DISCLAIMER OF WARRANTY
10 ** 
11 ** Ficl is freeware. Use it in any way that you like, with
12 ** the understanding that the code is not supported.
13 ** 
14 ** Any third party may reproduce, distribute, or modify the ficl
15 ** software code or any derivative  works thereof without any 
16 ** compensation or license, provided that the author information
17 ** and this disclaimer text are retained in the source code files.
18 ** The ficl software code is provided on an "as is"  basis without
19 ** warranty of any kind, including, without limitation, the implied
20 ** warranties of merchantability and fitness for a particular purpose
21 ** and their equivalents under the laws of any jurisdiction.  
22 ** 
23 ** I am interested in hearing from anyone who uses ficl. If you have
24 ** a problem, a success story, a defect, an enhancement request, or
25 ** if you would like to contribute to the ficl release (yay!), please
26 ** send me email at the address above. 
27 **
28 ** NOTE: this file depends on sysdep.h for the definition
29 ** of PORTABLE_LONGMULDIV and several abstract types.
30 **
31 */
32
33 /* $FreeBSD: src/sys/boot/ficl/math64.h,v 1.2 1999/09/29 04:43:06 dcs Exp $ */
34 /* $DragonFly: src/sys/boot/ficl/math64.h,v 1.2 2003/06/17 04:28:17 dillon Exp $ */
35
36 #if !defined (__MATH64_H__)
37 #define __MATH64_H__
38
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42
43 DPINT   m64Abs(DPINT x);
44 int     m64IsNegative(DPINT x);
45 DPUNS   m64Mac(DPUNS u, FICL_UNS mul, FICL_UNS add);
46 DPINT   m64MulI(FICL_INT x, FICL_INT y);
47 DPINT   m64Negate(DPINT x);
48 INTQR   m64FlooredDivI(DPINT num, FICL_INT den);
49 void    i64Push(FICL_STACK *pStack, DPINT i64);
50 DPINT   i64Pop(FICL_STACK *pStack);
51 void    u64Push(FICL_STACK *pStack, DPUNS u64);
52 DPUNS   u64Pop(FICL_STACK *pStack);
53 INTQR   m64SymmetricDivI(DPINT num, FICL_INT den);
54 UNS16   m64UMod(DPUNS *pUD, UNS16 base);
55
56
57 #if PORTABLE_LONGMULDIV != 0   /* see sysdep.h */
58 DPUNS   m64Add(DPUNS x, DPUNS y);
59 DPUNS   m64ASL( DPUNS x );
60 DPUNS   m64ASR( DPUNS x );
61 int     m64Compare(DPUNS x, DPUNS y);
62 DPUNS   m64Or( DPUNS x, DPUNS y );
63 DPUNS   m64Sub(DPUNS x, DPUNS y);
64 #endif
65
66 #define i64Extend(i64) (i64).hi = ((i64).lo < 0) ? -1L : 0 
67 #define m64CastIU(i64) (*(DPUNS *)(&(i64)))
68 #define m64CastUI(u64) (*(DPINT *)(&(u64)))
69 #define m64CastQRIU(iqr) (*(UNSQR *)(&(iqr)))
70 #define m64CastQRUI(uqr) (*(INTQR *)(&(uqr)))
71
72 #define CELL_HI_BIT (1L << (BITS_PER_CELL-1))
73
74 #ifdef __cplusplus
75 }
76 #endif
77
78 #endif
79