-
Notifications
You must be signed in to change notification settings - Fork 15
Added bignum module based on the fantastic bigz library. #98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,175 @@ | ||
|
|
||
| Namespace bigz | ||
|
|
||
| '#Import "native/*.h" 'ERROR in final exe ( problem in order of importation??? ) | ||
| #Import "native/bign.h" | ||
| #Import "native/bigq.h" | ||
| #Import "native/bigz.h" | ||
| #Import "native/bzf.h" | ||
|
|
||
| #Import "makefile" | ||
|
|
||
| #Import "structs" | ||
|
|
||
| Extern | ||
|
|
||
| 'bign.h | ||
|
|
||
| Enum BigNumBool | ||
| End | ||
| Const BN_FALSE:BigNumBool | ||
| Const BN_TRUE:BigNumBool | ||
|
|
||
| Enum BigNumCmp | ||
| End | ||
| Const BN_LT:BigNumCmp | ||
| Const BN_EQ:BigNumCmp | ||
| Const BN_GT:BigNumCmp | ||
|
|
||
| Enum BigNumCarry | ||
| End | ||
| Const BN_NOCARRY:BigNumCarry | ||
| Const BN_CARRY:BigNumCarry | ||
|
|
||
| Alias BigNumDigit:ULong | ||
| Alias BigNum:BigNumDigit Ptr | ||
| Alias BigNumLength:UInt | ||
|
|
||
| Function BnnAdd:BigNumCarry( mm:BigNum,ml:BigNumLength,nn:BigNum,nl:BigNumLength,carryin:BigNumCarry ) | ||
| Function BnnAddCarry:BigNumCarry( nn:BigNum,nl:BigNumLength,carryin:BigNumCarry ) | ||
| Function BnnAndDigits( n:BigNum,d:BigNumDigit ) | ||
| Function BnnAssign( mm:BigNum,nn:BigNum,nl:BigNumLength ) | ||
| Function BnnCompare:BigNumCmp( mm:BigNum,ml:BigNumLength,nn:BigNum,nl:BigNumLength ) | ||
| Function BnnCompareDigits:BigNumCmp( d1:BigNumDigit,d2:BigNumDigit ) | ||
| Function BnnComplement( nn:BigNum,nl:BigNumLength ) | ||
| Function BnnComplement2( nn:BigNum,nl:BigNumLength ) | ||
| Function BnnDivide( nn:BigNum,nl:BigNumLength,dd:BigNum,dl:BigNumLength ) | ||
| Function BnnDivideDigit:BigNumDigit( qq:BigNum,nn:BigNum,nl:BigNumLength,d:BigNumDigit ) | ||
| Function BnnGetDigit:BigNumDigit( nn:BigNum ) | ||
| Function BnnIsPower2:BigNumBool( nn:BigNum,nl:BigNumLength ) | ||
| Function BnnIsDigitEven:BigNumBool( d:BigNumDigit ) | ||
| Function BnnIsDigitOdd:BigNumBool( d:BigNumDigit ) | ||
| Function BnnIsDigitNormalized:BigNumBool( d:BigNumDigit ) | ||
| Function BnnIsDigitZero:BigNumBool( d:BigNumDigit ) | ||
| Function BnnIsZero:BigNumBool( nn:BigNum,nl:BigNumLength ) | ||
| Function BnnMultiply:BigNumCarry( pp:BigNum,pl:BigNumLength,mm:BigNum,ml:BigNumLength,nn:BigNum,nl:BigNumLength ) | ||
| Function BnnMultiplyDigit:BigNumCarry( pp:BigNum,pl:BigNumLength,mm:BigNum,ml:BigNumLength,d:BigNumDigit ) | ||
| Function BnnNumDigits:BigNumLength( nn:BigNum,nl:BigNumLength ) | ||
| Function BnnNumLength:BigNumLength( nn:BigNum,nl:BigNumLength ) | ||
| Function BnnNumCount:BigNumLength( nn:BigNum,nl:BigNumLength ) | ||
| Function BnnNumLeadingZeroBitsInDigit:BigNumLength( d:BigNumDigit ) | ||
| Function BnnOrDigits( n:BigNum,d:BigNumDigit ) | ||
| Function BnnSetDigit( nn:BigNum,d:BigNumDigit ) | ||
| Function BnnSetToZero( nn:BigNum,nl:BigNumLength ) | ||
| Function BnnShiftLeft:BigNumDigit( mm:BigNum,ml:BigNumLength,nbits:BigNumLength ) | ||
| Function BnnShiftRight:BigNumDigit( mm:BigNum,ml:BigNumLength,nbits:BigNumLength ) | ||
| Function BnnSubtract:BigNumCarry( mm:BigNum,ml:BigNumLength,nn:BigNum,nl:BigNumLength,carryin:BigNumCarry ) | ||
| Function BnnSubtractBorrow:BigNumCarry( nn:BigNum,nl:BigNumLength,carryin:BigNumCarry ) | ||
| Function BnnXorDigits( n:BigNum,d:BigNumDigit ) | ||
|
|
||
| 'bigq.h | ||
| 'TODO | ||
|
|
||
| 'bigz.h | ||
|
|
||
| Enum BzSign | ||
| End | ||
| Const BZ_MINUS:BzSign | ||
| Const BZ_ZERO:BzSign | ||
| Const BZ_PLUS:BzSign | ||
|
|
||
| Enum BzCmp | ||
| End | ||
| Const BZ_LT:BzCmp | ||
| Const BZ_EQ:BzCmp | ||
| Const BZ_GT:BzCmp | ||
|
|
||
| Enum BzStrFlag | ||
| End | ||
| Const BZ_UNTIL_END:BzStrFlag | ||
| Const BZ_UNTIL_INVALID:BzStrFlag | ||
| Const BZ_UNTIL_SLASH:BzStrFlag | ||
| Const BZ_UNTIL_SPACE:BzStrFlag | ||
|
|
||
| Struct BigZHeader | ||
| Field Size:BigNumLength | ||
| Field Sign:BzSign | ||
| End | ||
|
|
||
| Struct BigZStruct | ||
| Field Header:BigZHeader | ||
| Field Digits:BigNumDigit[] | ||
| End | ||
|
|
||
| Alias BigZ:BigZStruct Ptr | ||
| Alias BzChar:Byte | ||
| Alias BzUInt:UInt | ||
| Alias BzInt:Int | ||
| Alias BzLDouble:Double | ||
| Alias BzSeed:UInt | ||
|
|
||
| Function BzVersion:CString() | ||
| Function BzCreate:BigZ( Size:BigNumLength ) | ||
| Function BzNumDigits:BigNumLength( z:BigZ ) | ||
| Function BzLength:BigNumLength( z:BigZ ) | ||
| Function BzCopy:BigZ( z:BigZ ) | ||
| Function BzNegate:BigZ( z:BigZ ) | ||
| Function BzAbs:BigZ( z:BigZ ) | ||
| Function BzCompare:BzCmp( y:BigZ,z:BigZ ) | ||
| Function BzAdd:BigZ( y:BigZ,z:BigZ ) | ||
| Function BzSubtract:BigZ( y:BigZ,z:BigZ ) | ||
| Function BzMultiply:BigZ( y:BigZ,z:BigZ ) | ||
| Function BzDivide:BigZ( y:BigZ,z:BigZ,r:BigZ Ptr ) | ||
| Function BzDiv:BigZ( y:BigZ,z:BigZ ) | ||
| Function BzTruncate:BigZ( y:BigZ,z:BigZ ) | ||
| Function BzFloor:BigZ( y:BigZ,z:BigZ ) | ||
| Function BzCeiling:BigZ( y:BigZ,z:BigZ ) | ||
| Function BzRound:BigZ( y:BigZ,z:BigZ ) | ||
| Function BzMod:BigZ( y:BigZ,z:BigZ ) | ||
| Function BzRem:BigZ( y:BigZ,z:BigZ ) | ||
| Function BzPow:BigZ( base:BigZ,exponent:BzUInt ) | ||
| Function BzIsEven:BigNumBool( y:BigZ ) | ||
| Function BzIsOdd:BigNumBool( y:BigZ ) | ||
| Function BzToString:CString( z:BigZ,base:BigNumDigit,sign:Int ) | ||
| Function BzStrLen:Int( s:CString ) 'size_t | ||
| Function BzToStringBuffer:CString( z:BigZ,base:BigNumDigit,sign:Int,buf:CString,len:Int Ptr ) | ||
| Function BzToStringBufferExt:CString( z:BigZ,base:BigNumDigit,sign:Int,buf:CString,len:Int Ptr,slen:Int Ptr ) | ||
| Function BzFromStringLen:BigZ( s:CString,len:Int,base:BigNumDigit,flag:BzStrFlag ) | ||
| Function BzFromString:BigZ( s:CString,base:BigNumDigit,flag:BzStrFlag ) | ||
| Function BzFromInteger:BigZ( i:BzInt ) | ||
| Function BzFromUnsignedInteger:BigZ( i:BzUInt ) | ||
| Function BzToInteger:BzInt( z:BigZ ) | ||
| Function BzToDouble:Double( z:BigZ ) | ||
| Function BzToLongDouble:BzLDouble( z:BigZ ) | ||
| Function BzToIntegerPointer:Int( z:BigZ,p:BzInt Ptr ) | ||
| Function BzToUnsignedInteger:BzUInt( z:BigZ ) | ||
| Function BzToUnsignedIntegerPointer:Int( z:BigZ,p:BzUInt Ptr ) | ||
| Function BzFromBigNum:BigZ( n:BigNum,nl:BigNumLength ) | ||
| Function BzToBigNum:BigNum( z:BigZ,nl:BigNumLength Ptr ) | ||
| Function BzTestBit:BigNumBool( bit:BigNumLength,z:BigZ ) | ||
| Function BzBitCount:BigNumLength( z:BigZ ) | ||
| Function BzNot:BigZ( z:BigZ ) | ||
| Function BzAnd:BigZ( y:BigZ,z:BigZ ) | ||
| Function BzOr:BigZ( y:BigZ,z:BigZ ) | ||
| Function BzXor:BigZ( y:BigZ,z:BigZ ) | ||
| Function BzNand:BigZ( x:BigZ,y:BigZ ) | ||
| Function BzNor:BigZ( x:BigZ,y:BigZ ) | ||
| Function BzEqv:BigZ( x:BigZ,y:BigZ ) | ||
| Function BzAndC1:BigZ( x:BigZ,y:BigZ ) | ||
| Function BzAndC2:BigZ( x:BigZ,y:BigZ ) | ||
| Function BzOrC1:BigZ( x:BigZ,y:BigZ ) | ||
| Function BzOrC2:BigZ( x:BigZ,y:BigZ ) | ||
| Function BzAsh:BigZ( y:BigZ,n:Int ) | ||
| Function BzSqrt:BigZ( z:BigZ ) | ||
| Function BzLcm:BigZ( y:BigZ,z:BigZ ) | ||
| Function BzGcd:BigZ( y:BigZ,z:BigZ ) | ||
| Function BzRandom:BigZ( n:BigZ,seed:BzSeed Ptr ) | ||
| Function BzModExp:BigZ( base:BigZ,exponent:BigZ,modulus:BigZ ) | ||
| Function BzHash:BzUInt( z:BigZ ) | ||
|
|
||
| 'Function BnDebug( m:CString,bzstr:CString,n:BigNum,nl:BigNumLength,sign:BzSign ) | ||
| 'Function BzDebug( m:CString,y:BigZ ) | ||
|
|
||
| 'bzf.h | ||
|
|
||
| Function BzFactorial:BigZ( z:BigZ ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
|
|
||
| Namespace bigz | ||
|
|
||
| #If __TARGET__="linux" | ||
|
|
||
| #Import "makefile_linux" | ||
|
|
||
| #Endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
|
|
||
| Namespace bigz | ||
|
|
||
| #Import "native/bign.c" | ||
| #Import "native/bigq.c" | ||
| #Import "native/bigz.c" | ||
| #Import "native/bzf.c" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "module":"bigz", | ||
| "about":"BIGZ library wrapper", | ||
| "author":"Denise Amiga", | ||
| "version":"1.0.0", | ||
| "support":"http://github.com/denise-amiga/bigz-module", | ||
| "depends":[] | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can move this code directly into the
bigz.wx, deletemakefile.wxandmakefile_linux.wxfiles and commit/push this change.This will restart the CI, and we can check whether the module compiles on other platforms before merging it.