Sign extension of an unsigned word (Card).
% = SWord(value)
% | : signed 32-bit integer |
value | : card expression |
Expansion of a Card to a Long. The output value is in the range -32768 to +32767. This will be carried out by the copying of bit 15 (=sign bit) into the bits 16 to 31.
OpenW 1
Local a As Card
a = 12345 - 28784
Print Bin$(a, 32) // 00000000000000001011111111001001
Print Bin$(SWord(a), 32) // 11111111111111111011111111001001
This function loads the value into the eax register and performs a CDWE assembler instruction to extend the lower 16 bits to the upper 16 bits.
Byte(), Card(), Short(), UShort(), UWord(), Word()
{Created by Sjouke Hamstra; Last updated: 04/03/2017 by James Gaite}