/* DEFINITIONS FOR MIRANDA INTEGER PACKAGE (variable length) */ /************************************************************************** * Copyright (C) Research Software Limited 1985-90. All rights reserved. * * The Miranda system is distributed as free software under the terms in * * the file "COPYING" which is included in the distribution. * * * * Revised to C11 standard and made 64bit compatible, January 2020 * *------------------------------------------------------------------------*/ #define SIGNBIT 020000000000 /* most significant bit of 32 bit word */ #define IBASE 0100000 /* 2^15 (ie 8^5) so digit is a positive short */ #define MAXDIGIT 077777 #define DIGITWIDTH 15 #define digit0(x) (hd[x]&MAXDIGIT) #define digit(x) hd[x] #define rest(x) tl[x] #define big_is_positive(x) (!(hd[x]&SIGNBIT)) #define big_is_negative(x) (hd[x]&SIGNBIT) #define bigzero(x) (!digit(x)&&!rest(x)) #define getsmallint(x) (hd[x]&SIGNBIT?-digit0(x):digit(x)) #define stosmallint(x) make(INT,(x)<0?SIGNBIT|(-(x)):(x),0) long long big_toll(word); word big_fromll(long long); double big_tod(word); double big_log(word); double big_log10(word); int big_compare(word,word); word big_divide(word, word); word big_remainder(word,word); word big_negate(word); word bigoscan(char *,char *); word big_add(word,word); word big_pow(word,word); word bigscan(char *); void bigsetup(void); word big_subtract(word,word); word bigtimes(word,word); word bigtostr(word); word bigtostr8(word); word bigtostrx(word); word bigxscan(char *,char *); word dbltobig(double); int isnat(word); word strtobig(word,int); #define force_dbl(x) ((tag[(x)] == INT) ? big_tod((x)) : get_dbl((x))) /* END OF DEFINITIONS FOR INTEGER PACKAGE */