bigd - /* $Id: bigd.h $ */ /* SHORT COPYRIGHT NOTICE* This...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
/* $Id: bigd.h $ */ / /******************** SHORT COPYRIGHT NOTICE************************** This source code is part of the BigDigits multiple-precision arithmetic library Version 2.2 originally written by David Ireland, copyright (c) 2001-8 D.I. Management Services Pty Limited, all rights reserved. It is provided "as is" with no warranties. You may use this software under the terms of the full copyright notice "bigdigitsCopyright.txt" that should have been included with this library or can be obtained from <>. This notice must always be retained in any copy. ******************* END OF COPYRIGHT NOTICE***************************/ /* Last updated: $Date: 2008-07-31 12:54:00 $ $Revision: 2.2.0 $ $Author: dai $ */ * /* Interface to the BIGD library (BigDigits "bd" functions) Multiple-precision arithmetic for non-negative numbers using memory management and opaque pointers. */ * #ifndef BIGD_H_ #define BIGD_H_ 1 # #include "bigdtypes.h" # /**** USER CONFIGURABLE SECTION ****/ / /* [v2.1] Changed to use exact width integer types. [v2.2] Moved macros for exact-width types to "bigdtypes.h" */ * /* DIGIT_T type is not exposed by this library so we expose a synonym `bdigit_t' for a single digit */ typedef uint32_t bdigit_t; t /**** END OF USER CONFIGURABLE SECTION ****/ / #define OCTETS_PER_DIGIT (sizeof(bdigit_t)) /* Options for bdPrint */ #define BD_PRINT_NL 0x1 /* append a newline after printing */ #define BD_PRINT_TRIM 0x2 /* trim leading zero digits */ / #ifdef NO_ALLOCS #error NO_ALLOCS is not permitted with bd functions #endif # /* This interface uses opaque pointers of type BIGD using the conventions in "C Interfaces and Implementions" by David R. Hanson, Addison-Wesley, 1996, pp21-4. Thanks to Ian Tree for the C++ fudge. */ #define T BIGD #ifdef __cplusplus
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
typedef struct T2 *T; #else typedef struct T *T; #endif # #ifdef __cplusplus extern "C" { #endif # /* PROGRAMMER'S NOTES Where the function computes a new BIGD value, the result is returned in the first argument. Some functions do not allow variables to overlap (noted by w#v). Functions of type int generally return 0 to denote success but some return True/False (1/0) or borrow (+1) or error (-1). Functions of type size_t (an unsigned int) return a length. F Memory is allocated if the function might need it. It is only released when freed with bdFree(), e.g.: I BIGD b; b = bdNew(); ... bdFree(&b); */ * /******************************/ /* CONSTRUCTOR AND DESTRUCTOR */ /******************************/ / BIGD bdNew(void); /* Return handle to new BIGD object */ / void bdFree(BIGD *bd); v /* Zeroise and free BIGD memory - NB pass a pointer to the handle */ /*************************/ /* ARITHMETIC OPERATIONS */
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 7

bigd - /* $Id: bigd.h $ */ /* SHORT COPYRIGHT NOTICE* This...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online