// ============================================================ // // digit.h // // Copyright 2002, Dennis Meilicke and Rene Peralta // // ============================================================ // // Description: // // Declaration of the digit and double digit types, and // functions to deal with them. // // ============================================================ #ifndef __ln3_digit__ #define __ln3_digit__ // ---------------------------------------------------------------------- // Change the following as appropriate. You can use the endian.cc // program in the 'util' directory to determine the byte ordering // of your machine. // ---------------------------------------------------------------------- // #define __BIG_ENDIAN__ #define __LITTLE_ENDIAN__ // // AIX specific: include for typedef of size_t // #include // ============================================================ // // This header defines the "digit" and "double digit" types. // It may have to be modified for various architectures. In // particular, the syntax for declaring 64-bit integers varies // from compiler to compiler. Also, the definition of the // _ddSplit structure will have to be changed when moved to // a machine with a different "endian" architecture. // #ifdef _AIX typedef unsigned long digit_t; typedef long sdigit_t; typedef unsigned __int64 ddigit_t; typedef __int64 sddigit_t; #else typedef unsigned long digit_t; typedef long sdigit_t; typedef unsigned long long ddigit_t; typedef long long sddigit_t; #endif static const size_t digitSizeInBits = 32; #define maxDigitsBase10 (digitSizeInBits*100*LN3_DIGIT_ARRAY_SIZE)/333 // log base 2 of 10 is about 3.3219280948 typedef union _ddSplit { struct { #ifdef __BIG_ENDIAN__ digit_t high; digit_t low; #else digit_t low; digit_t high; #endif } dd; ddigit_t all; } ddSplit, ddSplit_t; typedef union _sddSplit { struct { #ifdef __BIG_ENDIAN__ digit_t high; digit_t low; #else digit_t low; digit_t high; #endif } dd; sddigit_t all; } sddSplit, sddSplit_t; #endif