mirror of
https://github.com/micropython/micropython.git
synced 2026-01-06 12:10:13 +01:00
Corrected viper int range to -2**31 to 2**31-1
@@ -35,7 +35,7 @@ add_to_array( my_array, 10 )
|
|||||||
viper_add_to_array( my_array, 10, len(my_array) )
|
viper_add_to_array( my_array, 10, len(my_array) )
|
||||||
|
|
||||||
```
|
```
|
||||||
This viper function is about 16 times faster on my ESP32-S3 with PSRAM wih an array of 10000.
|
This viper function is about 16 times faster on a ESP32-S3 with PSRAM wih an array of 10000.
|
||||||
|
|
||||||
In this example, the original add_to_array() function with @micropython.native decorator is about 1.6 times faster than the original function.
|
In this example, the original add_to_array() function with @micropython.native decorator is about 1.6 times faster than the original function.
|
||||||
|
|
||||||
@@ -109,7 +109,7 @@ In case you are familiar with C: The viper data types are similar to some C lang
|
|||||||
|
|
||||||
## The viper int data type
|
## The viper int data type
|
||||||
|
|
||||||
The viper ```int```data type in viper code is a special data type for fast signed integer operations. A viper `int` can hold values from -2\*\*31-1 to 2\*\*31, i.e. this is a 32 bit signed integer.
|
The viper ```int```data type in viper code is a special data type for fast signed integer operations. A viper `int` can hold values from -2\*\*31 to 2\*\*31-1, i.e. this is a 32 bit signed integer.
|
||||||
|
|
||||||
A viper `int` is different to the ```int``` we know in MicroPython, which is still available in viper decorated functions as ```builtins.int```. Hence this document will make a difference between a "viper ```int``` opposed to a ```builtins.int```.
|
A viper `int` is different to the ```int``` we know in MicroPython, which is still available in viper decorated functions as ```builtins.int```. Hence this document will make a difference between a "viper ```int``` opposed to a ```builtins.int```.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user