freebsd-dev/sys/boot/ficl/math64.h
Mike Smith 780ebb4b00 Add the Ficl (Forth Inspired Command Language) interpreter. If all goes well,
this will allow us to manage bloat in the loader by using a bytecoded HLL
rather than lots of C code.  It also offers an opportunity for vendors
or others with special applications to significantly customise the boot
process without having to commit to a divergent code branch.

This early commit is to allow others to experiment with the most effective
mechanisms for integrating FICL with the loader as it currently stands.

Ficl is distributed with the following license conditions:

"Ficl is freeware.  Use it in any way that you like, with the understanding
 that the code is not supported."

All source files contain authorship attributions.

Obtained from:	John Sadler (john_sadler@alum.mit.edu)
1998-11-03 06:11:35 +00:00

61 lines
2.0 KiB
C

/*******************************************************************
** m a t h 6 4 . h
** Forth Inspired Command Language - 64 bit math support routines
** Author: John Sadler (john_sadler@alum.mit.edu)
** Created: 25 January 1998
**
*******************************************************************/
/*
** N O T I C E -- DISCLAIMER OF WARRANTY
**
** Ficl is freeware. Use it in any way that you like, with
** the understanding that the code is not supported.
**
** Any third party may reproduce, distribute, or modify the ficl
** software code or any derivative works thereof without any
** compensation or license, provided that the author information
** and this disclaimer text are retained in the source code files.
** The ficl software code is provided on an "as is" basis without
** warranty of any kind, including, without limitation, the implied
** warranties of merchantability and fitness for a particular purpose
** and their equivalents under the laws of any jurisdiction.
**
** I am interested in hearing from anyone who uses ficl. If you have
** a problem, a success story, a defect, an enhancement request, or
** if you would like to contribute to the ficl release (yay!), please
** send me email at the address above.
*/
#if !defined (__MATH64_H__)
#define __MATH64_H__
#ifdef __cplusplus
extern "C" {
#endif
INT64 m64Abs(INT64 x);
int m64IsNegative(INT64 x);
UNS64 m64Mac(UNS64 u, UNS32 mul, UNS32 add);
INT64 m64MulI(INT32 x, INT32 y);
INT64 m64Negate(INT64 x);
INTQR m64FlooredDivI(INT64 num, INT32 den);
void i64Push(FICL_STACK *pStack, INT64 i64);
INT64 i64Pop(FICL_STACK *pStack);
void u64Push(FICL_STACK *pStack, UNS64 u64);
UNS64 u64Pop(FICL_STACK *pStack);
INTQR m64SymmetricDivI(INT64 num, INT32 den);
UNS16 m64UMod(UNS64 *pUD, UNS16 base);
#define i64Extend(i64) (i64).hi = ((i64).lo < 0) ? -1L : 0
#define m64CastIU(i64) (*(UNS64 *)(&(i64)))
#define m64CastUI(u64) (*(INT64 *)(&(u64)))
#define m64CastQRIU(iqr) (*(UNSQR *)(&(iqr)))
#define m64CastQRUI(uqr) (*(INTQR *)(&(uqr)))
#ifdef __cplusplus
}
#endif
#endif