func u16
Coerces an expression into an unsigned 16-bit value.
Syntax
u16 (value)
Formal Declaration
u16:u16 (value:any)
Parameters
value An expression to be coerced. All types are valid.
Derivation of the U16 Bit Pattern
--------------------------------------------------------------------------------------------
| | |
| Parameter Type | Action |
| | |
--------------------------------------------------------------------------------------------
| | |
| BOOL | 1 if TRUE, 0 if FALSE. |
| | |
--------------------------------------------------------------------------------------------
| | |
| U16 | Transfer the original bit pattern unchanged. |
| S16 | |
| | |
--------------------------------------------------------------------------------------------
| | |
| U32 | Transfer the low-order 16 bits. High-order bits are |
| S32 | discarded. |
| SPTR | |
| | |
--------------------------------------------------------------------------------------------
| | |
| LPTR | Transfer the low-order 16 bits of the address (offset part). |
| PROG | All other parts of the address are discarded. |
| GRP | |
| PUB | |
| LGRP | |
| LPUB | |
| SYS | |
| USER | |
| TRANS | |
| CST | |
| CSTX | |
| | |
--------------------------------------------------------------------------------------------
| | |
| STR | Transfer the ASCII bit pattern for the last two characters |
| | in the string. Strings shorter than two characters are |
| | treated as if they were extended on the left with nulls. |
| | |
--------------------------------------------------------------------------------------------
Examples
$nmdat > wl u16( 1 )
$1
$nmdat > wl u16( ffff )
$ffff
$nmdat > wl u16( ffff ):"#"
$65535
$nmdat > wl u16( 1234abcd )
$abcd
$nmdat > wl u16( -1 )
$ffff
$nmdat > wl u16( ffff ):"#"
#65535
$nmdat > wl u16( 1234.5678 )
$5678
$nmdat > wl u16( true )
$1
$nmdat > wl u16( "ABCDEFG" )
$4647
$nmdat > wl u16( prog(1.2) )
$2
Limitations, Restrictions
none