INTPOS() Converts a signed integer into an unsigned integer ------------------------------------------------------------------------------ Syntax INTPOS(<nSigned|cHexSigned>,[<l32Bit>]) --> nUnsigned Arguments <nUnsigned|cHexUnsigned> Designates either a numeric value or hexadecimal digit string to convert into a 16-bit or 32-bit unsigned integer. <l32Bit> If this optional parameter is designated as .T., the function processes the designated value as a 32-bit signed integer. The default value is a 16-bit signed integer (.F.). Returns INTPOS() returns an unsigned 16-bit or 32-bit integer. Description This function converts signed 16-bit or 32-bit integers into the corresponding unsigned number. Based on the optional parameter and the logical value it is assigned, you can work with 16-bit or 32-bit values. For the 16-bit variant, all values in the 0 to 32767 range are unchanged. However, all negative values from -1 to -32768 are changed. When the optional parameter is designated as .T., the range of values stretches from -2147483648 to +2147483647. Note . This function returns a 0 result for invalid paramerters. Examples . Show simple conversions: ? INTPOS(-1) // 65535 ? INTPOS(-2) // 65534 ? INTPOS(30000) // 30000 ? INTPOS(60000) // 60000 Warning! When working with 16-bit values INTPOS(0) = INTPOS(65536): ? INTPOS(0) // 0 ? INTPOS(65536) // 0 . Show values larger than 65536 in 16-bit mode. For example, the difference between 90000 and 65536 is 24464: ? INTPOS(90000) // 24464 . However, in 32-bit mode: ? INTPOS(90000, .T.) // 90000 ? INTPOS(-1, .T.) // 4294967295 // (largest 32-bit number) ? INTPOS(-60000, .T.) // 4294907296 ? INTPOS(-90000, .T.) // 4294877296
See Also: INTNEG() NUMAND() NUMOR() NUMXOR()