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 
00038 typedef struct
00039 {
00040     guint64 hi;
00041     guint64 lo;
00042     gshort isneg;  
00043     gshort isbig;  
00044 } QofInt128;
00045 
00047 inline gboolean equal128 (QofInt128 a, QofInt128 b);
00048 
00050 inline gint cmp128 (QofInt128 a, QofInt128 b);
00051 
00053 inline QofInt128 shift128 (QofInt128 x);
00054 
00056 inline QofInt128 shiftleft128 (QofInt128 x);
00057 
00059 inline QofInt128 inc128 (QofInt128 a);
00060 
00062 inline QofInt128 add128 (QofInt128 a, QofInt128 b);
00063 
00067 inline QofInt128 mult128 (gint64 a, gint64 b);
00068 
00072 inline QofInt128 div128 (QofInt128 n, gint64 d);
00073 
00079 inline gint64 rem128 (QofInt128 n, gint64 d);
00080 
00082 inline guint64 gcf64 (guint64 num, guint64 denom);
00083 
00085 inline QofInt128 lcm128 (guint64 a, guint64 b);
00086 
00089 #endif

Generated on Thu Jan 31 22:50:26 2008 for QOF by  doxygen 1.5.4