From 0326c753229fe7af6b7df181004aa8d62eacf4b8 Mon Sep 17 00:00:00 2001 From: bixb922 <70152274+bixb922@users.noreply.github.com> Date: Sat, 4 May 2024 14:36:38 -0400 Subject: [PATCH] Clarify possible uses of uint --- Improving-performance-with-Viper-code.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Improving-performance-with-Viper-code.md b/Improving-performance-with-Viper-code.md index 03deb2b..99142e2 100644 --- a/Improving-performance-with-Viper-code.md +++ b/Improving-performance-with-Viper-code.md @@ -264,7 +264,12 @@ int() casting is very fast in viper code. ## The viper uint data type -This data type is in most aspects similar to viper `int` but the range is 0 to 2\*\*32-1, i.e. it's a unsigned 32 bit integer. +This data type is in most aspects similar to viper `int` but the range is 0 to 2\*\*32-1, i.e. it's an unsigned 32 bit integer. Typical uses could be: + +* As return type hint when return values could fall between the maximum `int` value and 2\*\*32-1 +* For unsigned int arithmetic, in the range 0 to 2\*\*32-1 +* For pointer arithmetic, see `ptr` data types below + The uint() cast function will return the last 4 bytes of `builtins.int` as a unsigned 32 bit int.