diff options
author | VolTer <mew.pur.pur@abv.bg> | 2023-01-26 01:45:38 +0100 |
---|---|---|
committer | VolTer <mew.pur.pur@abv.bg> | 2023-05-01 02:32:46 +0200 |
commit | fb5cb735a2edd58ffba16f18dda242a13ffe253a (patch) | |
tree | 0f36924ee1425fab5d028267765151d9969250a7 | |
parent | 10d22a4b35b33ad89f626c261ef7f1aeae81daf3 (diff) | |
download | redot-engine-fb5cb735a2edd58ffba16f18dda242a13ffe253a.tar.gz |
Fixed edge cases of nearest_po2 function
-rw-r--r-- | doc/classes/@GlobalScope.xml | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml index 4fdb7d82c5..27b082328e 100644 --- a/doc/classes/@GlobalScope.xml +++ b/doc/classes/@GlobalScope.xml @@ -692,8 +692,7 @@ <return type="int" /> <param index="0" name="value" type="int" /> <description> - Returns the nearest equal or larger power of 2 for the integer [param value]. - In other words, returns the smallest value [code]a[/code] where [code]a = pow(2, n)[/code] such that [code]value <= a[/code] for some non-negative integer [code]n[/code]. + Returns the smallest integer power of 2 that is greater than or equal to [param value]. [codeblock] nearest_po2(3) # Returns 4 nearest_po2(4) # Returns 4 @@ -702,7 +701,7 @@ nearest_po2(0) # Returns 0 (this may not be expected) nearest_po2(-1) # Returns 0 (this may not be expected) [/codeblock] - [b]Warning:[/b] Due to the way it is implemented, this function returns [code]0[/code] rather than [code]1[/code] for negative values of [param value] (in reality, 1 is the smallest integer power of 2). + [b]Warning:[/b] Due to its implementation, this method returns [code]0[/code] rather than [code]1[/code] for values less than or equal to [code]0[/code], with an exception for [param value] being the smallest negative 64-bit integer ([code]-9223372036854775808[/code]) in which case the [param value] is returned unchanged. </description> </method> <method name="pingpong"> |