"Sputnik" help  
Sputnik Help
HasNegativeSign(<value>, <sizeCode>)

Description

Checks whether a given unsigned integer has a negative sign.

Parameters

<value> The value to be checked.
<sizeCode> The size code indicating the size of the value. Use @SizeCodeDWord for 32-bit values and @SizeCodeQWord for 64-bit values.

Return Value

Success: Returns true.
Failure: Returns false.

Remarks

This function allows you to determine whether a given unsigned integer has a negative sign based on the size code provided. The function checks if the sign bit of the unsigned integer is set to 1, indicating a negative sign. It performs the check by bitwise ANDing the unsigned integer with the sign mask determined by the size code. If the result is non-zero, it means the sign bit is set, and the function returns True, indicating a negative sign. Otherwise, it returns False.

Related

Example

Example of usage:

my $value = -777;
say HasNegativeSign((^UInt64)$value, @SizeCodeDWord);
my $value = 777;
say HasNegativeSign((^UInt64)$value, @SizeCodeDWord);

// PRINTS
// true
// false

 


Contact
Cheryl (uberfox@hotmail.com)
Homepage
http://ubersoft.org