| 1.11 Biglnt .65 |
| 1.11.1 Biglnt.Add .65 |
| 1.11.2 Biglnt.And .65 |
| 1.11.3 Biglnt.AsHexString .66 |
| 1.11.4 Biglnt.Create .66 |
| 1.11.5 Biglnt.Divide .67 |
| 1.11.6 Biglnt.GetBit .67 |
| 1.11.7 Biglnt.Multiply .68 |
| 1.11.8 Biglnt.Negate .69 |
| 1.11.9 Biglnt.Not .69 |
| 1.11.10 Biglnt.Or .70 |
| 1.11.11 Biglnt.Set .70 |
| 1.11.12 Biglnt.SetBit .71 |
| 1.11.13 Biglnt.SetZero .71 |
| 1.11.14 Biglnt.ShiftLeft .72 |
| 1.11.15 Biglnt.ShiftRight .72 |
| 1.11.16 Biglnt.Subtract .73 |
| 1.11.17 Biglnt.ToNumber .74 |
| 1.11.18 Biglnt.Xor .74 |
|
|
| Biglnt |
| Biglnt.Add |
| Brief |
| Add the specified value to a Biglnt. |
| Definition |
| ! Biglnt.Add(Biglnt dst, Biglnt|number|string srcl, Biglnt|number|string src2) |
| Arguments |
| dst - the Biglnt to modifysrcl - the first/left sourcesrc2 - the second/right source |
| Return Values |
| Description |
| Adds the specified values to the specified Biglnt. dst = srcl + src2. |
| Examples |
| biglntl:Add(biglntl, 32) |
| ; biglnt2:Add(biglntl, "0x393823") |
| j biglnt3:Add("723523", biglnt3) |
| j biglnt4:Add(biglnt3, biglnt3) |
| See Also |
| � Biglnt.Create |
| Biglnt.And |
| Brief |
| Perform a bitwise AND operation with a Biglnt and a specified value. |
| Definition |
| ! Biglnt.And(Biglnt dst, Biglnt|number|string srcl, Biglnt|number|string src2) |
| Arguments |
| dst - the Biglnt to modifysrcl - the first/left sourcesrc2 - the second/right source |
| Return Values |
| Description |
| Perform a bitwise AND operation with a Biglnt and a specified value. String values may be decimal, or if prefixed with Ox or OX, hexadecimal. The |
| string will be checked to ensure it is a valid number and fits within the Bigint's precision limit. |
| Examples |
| j biglntl:And(32) |
| ; biglnt2:And("0x8000" ) |
| ; biglnt3:And("128" ) |
| ! biglnt4:And(biglnt3) |
| See Also |
| � Biglnt.Create |
| Biglnt.AsHexString |
| Brief |
| Generates a hexadecimal string representation of the Biglnt. |
| Definition |
| ! string Biglnt.AsHexString(Biglnt i) |
| Arguments |
| i - a Biglnt |
| Return Values |
| A string containing the Biglnt value in hexadecimal. |
| Description |
| Generates a hexadecimal string representation of the Biglnt. The string will contain only hexadecimal digits (0-9, A-F) with no prefix (Ox or similar). |
| Examples |
| i local i = Biglnt.Create(64, "ABCDEF01234456789") |
| ; print(i:AsHexString()) � prints "ABCDEF01234456789" |
| See Also |
| � Biglnt.Create |
| Biglnt.Create |
| Brief |
| Create a signed big integer with the specified number of bits. |
| Definition |
| ! Biglnt Biglnt.Create(number numberOfBits, number|Biglnt|string initialValue = 0 ) |
| Arguments |
| numberOfBits - size of integer in bits |
| initialValue - value to initialise returned big integer in either number, string or Biglnt. |
| Return Values |
| A big integer with the specified size, or nil on failure. |
| Description |
| Create a big integer with the specified number of bits of precision. At present only 32 and 64 bit integers are supported. Note that these are not |
| "native" types and therefore have a significant performance penalty, and should only be used where necessary. Normal integer arithmetic should |
| be done using the built-in Lua number type. String values may be either decimal or, if prefixed with Ox or OX, hexadecimal. The string will be |
| checked to ensure it is a valid number and fits within the Biglnt's precision limit. |
| Examples |
| local biglnt = Biglnt.Create(64, "0xl234567890ABCDEF") |
| local biglnt2 = Biglnt.Create (64, ,, 1234567890123456") |
| local biglnt3 = Biglnt.Create(32, 123321) |
| local biglnt4 = Biglnt.Create (32, biglnt3) |
| See Also |
| � Biglnt.Set |
| Biglnt.Divide |
| Brief |
| Divide a Biglnt by a specified value. |
| Definition |
| Biglnt.Divide(Biglnt dst, Biglnt|number|string srcl, Biglnt|number|string src2) |
| Arguments |
| dst - the Biglnt to modifysrcl - the first/left sourcesrc2 - the second/right source |
| Return Values |
| Description |
| Divide the specified Biglnt by the specified value. String values may be decimal, or if prefixed with Ox or OX, hexadecimal. The string will be |
| checked to ensure it is a valid number and fits within the Biglnt's precision limit. |
| Examples |
| biglntl:Divide(32) |
| biglnt2:Divide("0x393823") |
| biglnt3:Divide("723523") |
| biglnt4:Divide(biglnt3) |
| See Also |
| � Biglnt.Create |
| Biglnt.GetBit |
| Brief |
| Returns the value of the specified bit. |
| Definition |
| boolean Biglnt.GetBit( Biglnt i, number bitlndex ) |
| Arguments |
| i - a Biglntbitlndex - Which bit to get the value of. bitlndex starts at 0. |
| Return Values |
| Returns the value of the specified bit. |
| Description |
| Returns the value of the specified bit. |
| Examples |
| j local i = Biglnt.Create ( 64, -1 ) |
| i print( 'top bit is Biglnt.GetBit(i, 63 ) ) |
| See Also |
| � Biglnt.Create |
| � Biglnt.SetBit |
| Biglnt.Multiply |
| Brief |
| Multiply the specified value with a Biglnt. |
| Definition |
| Biglnt.Multiply(Biglnt dst, Biglnt|number|string srcl, Biglnt|number|string src2) |
| Arguments |
| dst - the Biglnt to modifysrcl - the first/left sourcesrc2 - the second/right source |
| Return Values |
| Description |
| Multiply the specified value with the specified Biglnt. String values may be decimal, or if prefixed with Ox or OX, hexadecimal. The string will be |
| checked to ensure it is a valid number and fits within the Biglnt's precision limit. |
| Examples |
| biglntl:Multiply (32) |
| biglnt2:Multiply ( "0x393823") |
| biglnt3:Multiply ( "723523") |
| biglnt4:Multiply(biglnt3) |
| See Also |
| Biglnt.Create |
| Biglnt.Negate |
| Brief |
| Negate a Biglnt. |
| Definition |
| ! Biglnt.Negate(Biglnt i) |
| Arguments |
| i - the Biglnt to negate |
| Return Values |
| Description |
| Negate the specified Biglnt, that is, if it's current value is x, set it to -x. |
| Examples |
| biglnt1:Negate() |
| See Also |
| � Biglnt.Create |
| Biglnt.Not |
| Brief |
| Perform a bitwise NOT operation on the specified Biglnt. |
| Definition |
| j Biglnt.Not(Biglnt i) |
| Arguments |
| i - the Biglnt on which to perform bitwise NOT |
| Return Values |
| Description |
| Perform a bitwise NOT operation on the specified Biglnt. |
| Examples |
| biglntl:Not() |
| See Also |
| Biglnt.Create |
| Biglnt.Or |
| Brief |
| Perform a bitwise OR operation with a Biglnt and a specified value. |
| Definition |
| i Biglnt.Or(Biglnt dst, Biglnt|number|string srcl, Biglnt|number|string src2) |
| Arguments |
| dst - the Biglnt to modifysrcl - the first/left sourcesrc2 - the second/right source |
| Return Values |
| Description |
| Perform a bitwise OR operation with a Biglnt and a specified value. String values may be decimal, or if prefixed with Ox or OX, hexadecimal. The |
| string will be checked to ensure it is a valid number and fits within the Biglnt's precision limit. |
| Examples |
| ! biglntl:Or(32) |
| i biglnt2:Or("0x8000") |
| | biglnt3:0r("128") |
| ! biglnt4:Or(biglnt3) |
| See Also |
| � Biglnt.Create |
| Biglnt.Set |
| Brief |
| Set a big integer to the specified value |
| Definition |
| ! Biglnt.Set(Biglnt|number|string value) |
| Arguments |
| value - value to set |
| Return Values |
| Description |
| Set a big integer to the specified value. String values may be either decimal or, if prefixed with Ox or OX, hexadecimal. The string will be checked |
| to ensure it is a valid number and fits within the Biglnt's precision limit. |
| Examples |
| biglnt:Set("0xl234567890ABCDEF") |
| biglnt2:Set("1234567890123456") |
| bigInt3:Set (123321) |
| biglnt4:Set(biglnt3) |
| See Also |
| � Biglnt.Create |
| Biglnt.SetBit |
| Brief |
| Sets the the specified bit to the specified value. |
| Definition |
| ! boolean Biglnt.SetBit( Biglnt i, number bitlndex, boolean value ) |
| Arguments |
| i - a Biglntbitlndex - Which bit to get the value of. bitlndex starts at 0.value - The value to set the bit to, true is on and false is off. |
| Return Values |
| None |
| Description |
| Sets the the specified bit to the specified value. |
| Examples |
| ! local i = Biglnt.Create ( 64, 1234 ) |
| i Biglnt.SetBit( i, 63, true ) ) � Make it negative. |
| See Also |
| � Biglnt.Create |
| � Biglnt.GetBit |
| Biglnt.SetZero |
| Brief |
| Set the specified Biglnt to zero. |
| Definition |
| Biglnt.SetZero(Biglnt i) |
| Arguments |
| i - the Biglnt to set to zero |
| Return Values |
| Description |
| Set the specified Biglnt to zero. |
| Examples |
| ! biglntl:SetZero() |
| See Also |
| � Biglnt.Create |
| Biglnt.ShiftLeft |
| Brief |
| Bit shifts the source integer left by the specified amount of bits and saves in the destination. |
| Definition |
| Biglnt.ShiftLeft( Biglnt dst, Biglnt|number|string src, Biglnt|number|string shift ) |
| Arguments |
| dst - The Biglnt to save the result to.src - The value to shift.shift - the amount to shift by. |
| Return Values |
| None |
| Description |
| Bit shifts the source integer left by the specified amount of bits and saves the result in the destination. |
| Examples |
| j dst = Biglnt.Create( 64 ) |
| ! src = Biglnt.Create ( 64, "OxFFOOOO" ) |
| Biglnt.ShiftLeft ( dst, src, 5 ) |
| See Also |
| � Biglnt.Create |
| � Biglnt.ShiftRight |
| � Biglnt.GetBit |
| � Biglnt. SetBit |
| Biglnt.ShiftRight |
| Brief |
| Bit shifts the source integer right by the specified amount of bits and saves the result in the destination. |
| Definition |
| Biglnt.ShiftRight( Biglnt dst, Biglnt|number|string src, Biglnt|number|string shift ) |
| Arguments |
| dst - The Biglnt to save the result to.src - The value to shift.shift - the amount to shift by. |
| Return Values |
| None |
| Description |
| Bit shifts the source integer right by the specified amount of bits and saves the result in the destination. |
| Examples |
| dst = Biglnt.Create ( 64 ) |
| src = Biglnt.Create ( 64, "OxFFOOOO" ) |
| Biglnt.ShiftRight( dst, src, 5 ) |
| See Also |
| � Biglnt.Create |
| � Biglnt.ShiftRight |
| � Biglnt.GetBit |
| � Biglnt.SetBit |
| Biglnt.Subtract |
| Brief |
| Subtract the specified value from a Biglnt. |
| Definition |
| ! Biglnt.Subtract(Biglnt dst, Biglnt|number|string srcl, Biglnt|number|string src2) |
| Arguments |
| dst - the Biglnt to modifysrcl - the first/left sourcesrc2 - the second/right source |
| Return Values |
| Description |
| Subtract the specified value from the specified Biglnt. String values may be decimal, or if prefixed with Ox or OX, hexadecimal. The string will be |
| checked to ensure it is a valid number and fits within the Biglnt's precision limit. |
| Examples |
| biglnt1:Subtract (32) |
| biglnt2:Subtract("0x393823") |
| biglnt3:Subtract ("723523") |
| biglnt4:Subtract(biglnt3) |
| See Also |
| � Biglnt.Create |
| Biglnt.ToNumber |
| Brief |
| Converts a Biglnt to a native Lua number value if possible. |
| Definition |
| ! number Biglnt.ToNumber( Biglnt i ) |
| Arguments |
| i - a Biglnt |
| Return Values |
| The Lua number value equivalent to the Biglnt. |
| Description |
| Converts a Biglnt to a native Lua number value if possible. If the Biglnt is out of range, a Lua error will occur. |
| Examples |
| j local i = Biglnt.Create ( 32, 1234 ) |
| i print(i:ToNumber() +1) � prints 1235 |
| j i:Set("121223523262") |
| ! �print(i:ToNumber()) this will error |
| See Also |
| � Biglnt.Create |
| Biglnt.Xor |
| Brief |
| Perform a bitwise XOR operation with a Biglnt and a specified value. |
| Definition |
| ! Biglnt.Xor(Biglnt dst, Biglnt|number|string srcl, Biglnt|number|string src2) |
| Arguments |
| dst - the Biglnt to modifysrcl - the first/left sourcesrc2 - the second/right source |
| Return Values |
| Description |
| Perform a bitwise XOR operation with a Biglnt and a specified value. String values may be decimal, or if prefixed with Ox or OX, hexadecimal. The |
| string will be checked to ensure it is a valid number and fits within the Bigint's precision limit. |
| Examples |
| biglntl:Xor (32) |
| ; biglnt2:Xor("0x8000") |
| ; biglnt3:Xor ("128") |
| j biglnt4:Xor(biglnt3) |
| See Also |
| � Biglnt. Create |
|
|