Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //BigInteger.h
- #ifndef BIG_INTEGER_H
- #define BIG_INTEGER_H
- /*
- * BIG_INTEGER_MAX_SIZE is the size the struct will have,
- * override this macro to obtain bigger integers otherwise
- * default value is of 32 byte
- */
- #ifndef BIG_INTEGER_MAX_SIZE
- #define BIG_INTEGER_MAX_SIZE 32
- #endif
- #define POSITIVE 1
- #define NEGATIVE -1
- typedef struct{
- unsigned char data[BIG_INTEGER_MAX_SIZE];
- short sign;
- }BigInteger;
- //----------------------------------------------Costructors----------------------------------------------------
- /*
- * Standard method to initialize a BigInteger
- * Format has to be like that:
- * 3321 = {3,3,2,1}
- */
- BigInteger* newBigInteger(int elements,int number[]);
- /*
- * newBigIntegerFromChar(char* ) expects the input formatted as a string
- * like "8223123343456" input values not containing only digits
- * will result in a NULL
- */
- BigInteger* newBigIntegerFromChar(char*);
- BigInteger* newBigIntegerFromInt(int );
- //----------------------------------------------Interfaces------------------------------------------------------
- /*
- * Interface method to perform operations with BigInteger
- *
- */
- BigInteger* add(BigInteger* ,BigInteger* );
- BigInteger* sub(BigInteger* ,BigInteger* );
- //-----------------------------------------------Utils----------------------------------------------------------
- void print(BigInteger* );
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement