qofmath128.h

00001 /********************************************************************
00002  * qofmath128.h -- an 128-bit integer library                       *
00003  * Copyright (C) 2004 Linas Vepstas <linas@linas.org>               *
00004  *                                                                  *
00005  * This program is free software; you can redistribute it and/or    *
00006  * modify it under the terms of the GNU General Public License as   *
00007  * published by the Free Software Foundation; either version 2 of   *
00008  * the License, or (at your option) any later version.              *
00009  *                                                                  *
00010  * This program is distributed in the hope that it will be useful,  *
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of   *
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *
00013  * GNU General Public License for more details.                     *
00014  *                                                                  *
00015  * You should have received a copy of the GNU General Public License*
00016  * along with this program; if not, contact:                        *
00017  *                                                                  *
00018  * Free Software Foundation           Voice:  +1-617-542-5942       *
00019  * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652       *
00020  * Boston, MA  02110-1301,  USA       gnu@gnu.org                   *
00021  *                                                                  *
00022  *******************************************************************/
00023 
00024 #ifndef QOF_MATH_128_H
00025 #define QOF_MATH_128_H
00026 
00027 #include <glib.h>
00028 
00035 typedef struct
00036 {
00037     guint64 hi;
00038     guint64 lo;
00039     short isneg;  
00040     short isbig;  
00041 } qofint128;
00042 
00044 inline gboolean equal128 (qofint128 a, qofint128 b);
00045 
00047 inline int cmp128 (qofint128 a, qofint128 b);
00048 
00050 inline qofint128 shift128 (qofint128 x);
00051 
00053 inline qofint128 shiftleft128 (qofint128 x);
00054 
00056 inline qofint128 inc128 (qofint128 a);
00057 
00059 inline qofint128 add128 (qofint128 a, qofint128 b);
00060 
00064 inline qofint128 mult128 (gint64 a, gint64 b);
00065 
00069 inline qofint128 div128 (qofint128 n, gint64 d);
00070 
00076 inline gint64 rem128 (qofint128 n, gint64 d);
00077 
00079 inline guint64 gcf64 (guint64 num, guint64 denom);
00080 
00082 inline qofint128 lcm128 (guint64 a, guint64 b);
00083 
00084 #endif
00085 

Generated on Fri Sep 1 15:35:56 2006 for QOF by  doxygen 1.4.6