bit64 - 32 Basic arithmetic and logical operations on 64-bit data on bit systems#
Adapted Air780E/Air700E Air780EP/Air780EPV Air105 ESP32C3 ESP32S3
Note
This page document is automatically generated by this file. If there is any error, please submit issue or help modify pr, thank you!
Tip
This library has its own demo,click this link to view the demo example of bit64
bit64.to32(data64bit)#
64bit Data to 32bit output
Parameters
Incoming Value Type |
Explanation |
---|---|
string |
9 byte data |
Return Value
return value type |
explanation |
---|---|
any |
Output int according to 64bit data or number |
Examples
None
bit64.to64(data32bit)#
32bit Data into 64bit data
Parameters
Incoming Value Type |
Explanation |
---|---|
int/number |
32bit Data |
Return Value
return value type |
explanation |
---|---|
string |
9 byte data |
Examples
None
bit64.show(a,type,flag)#
64bit Data is formatted to print as a string to display the value.
Parameters
Incoming Value Type |
Explanation |
---|---|
string |
64-bit data that needs to be printed |
int |
Bis, 10=10, 16=16, default 10, only 10 or 16 |
boolean |
Whether shaping is printed in an unsigned manner, true is, false is not, default false, floating point ignore |
Return Value
return value type |
explanation |
---|---|
string |
Values that can be printed |
Examples
None
bit64.plus(a,b,flag1,flag2)#
64bit Data addition, one of a B, a and B is floating point, according to floating point operation
Parameters
Incoming Value Type |
Explanation |
---|---|
string |
a |
string/int/number |
b |
boolean |
Whether the shaping operation is unsigned, true is, false is not, the default is false, floating-point operation ignores |
boolean |
Whether the floating-point operation result should be forced to be converted into an integer, true is, false is not, the default is false, and the shaping operation is ignored. |
Return Value
return value type |
explanation |
---|---|
string |
9 byte data |
Examples
None
bit64.minus(a,b,flag1,flag2)#
64bit Data subtraction, a-b one of a and B is floating point, according to floating point operation
Parameters
Incoming Value Type |
Explanation |
---|---|
string |
a |
string/int/number |
b |
boolean |
Whether the shaping operation is unsigned, true is, false is not, the default is false, floating-point operation ignores |
boolean |
Whether the floating-point operation result should be forced to be converted into an integer, true is, false is not, the default is false, and the shaping operation is ignored. |
Return Value
return value type |
explanation |
---|---|
string |
9 byte data |
Examples
None
bit64.multi(a,b,flag1,flag2)#
64bit Data multiplication, a * B, one of a and B is floating point, according to floating point operation
Parameters
Incoming Value Type |
Explanation |
---|---|
string |
a |
string/int/number |
b |
boolean |
Whether the shaping operation is unsigned, true is, false is not, the default is false, floating-point operation ignores |
boolean |
Whether the floating-point operation result should be forced to be converted into an integer, true is, false is not, the default is false, and the shaping operation is ignored. |
Return Value
return value type |
explanation |
---|---|
string |
9 byte data |
Examples
None
bit64.pide(a,b,flag1,flag2)#
64bit Data division, a/B, one of a and B is floating point, according to floating point operation
Parameters
Incoming Value Type |
Explanation |
---|---|
string |
a |
string/int/number |
b |
boolean |
Whether the shaping operation is unsigned, true is, false is not, the default is false, floating-point operation ignores |
boolean |
Whether the floating-point operation result should be forced to be converted into an integer, true is, false is not, the default is false, and the shaping operation is ignored. |
Return Value
return value type |
explanation |
---|---|
string |
9 byte data |
Examples
None
bit64.shift(a,b,flag)#
64bit Data displacement a>> B or a<<b
Parameters
Incoming Value Type |
Explanation |
---|---|
string |
a |
int |
b |
boolean |
Displacement direction, true left <<,false right>>, default false |
Return Value
return value type |
explanation |
---|---|
string |
9 byte data |
Examples
None
bit64.strtoll(data, base)#
Convert string to LongLong data
Parameters
Incoming Value Type |
Explanation |
---|---|
string |
data to be transformed, must exist |
int |
Conversion, default 10, optional 16 or 8 |
Return Value
return value type |
explanation |
---|---|
string |
9 byte data |
Examples
-- This API was added on 2023.10.27
-- Reminder, if the conversion fails, it returns 9 bytes.0x00
local data = bit64.strtoll("864040064024194", 10)
log.info("data", data:toHex())
log.info("data", bit64.show(data))