Corrected viper int range to -2**31 to 2**31-1

master
bixb922 2024-04-18 15:05:11 -04:00
rodzic 69a38d9fcd
commit 6fdc19f011
1 zmienionych plików z 2 dodań i 2 usunięć

@ -35,7 +35,7 @@ add_to_array( my_array, 10 )
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.
@ -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 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```.