From 6fdc19f01126218cb024d9ed5dd28ecde585d338 Mon Sep 17 00:00:00 2001 From: bixb922 <70152274+bixb922@users.noreply.github.com> Date: Thu, 18 Apr 2024 15:05:11 -0400 Subject: [PATCH] Corrected viper int range to -2**31 to 2**31-1 --- Improving-performance-with-Viper-code.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Improving-performance-with-Viper-code.md b/Improving-performance-with-Viper-code.md index d44553c..6cee895 100644 --- a/Improving-performance-with-Viper-code.md +++ b/Improving-performance-with-Viper-code.md @@ -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```.