Wiki source for KeyPgLoWord


Show raw source

{{fbdoc item="title" value="LOWORD"}}----
Gets the lowest 16bit word of the operand.

{{fbdoc item="syntax"}}##
[[KeyPgPpdefine|#define]] **Loword**( //expr// ) ([[KeyPgCast|Cast]]([[KeyPgUinteger|Uinteger]], //expr//) [[KeyPgOpAnd|and]] &h0000FFFF)
##
{{fbdoc item="usage"}}##
//result// = **Loword**( //expr// )
##
{{fbdoc item="param"}}
##//expr//##
A numeric expression, converted to an ##[[KeyPgUinteger|Uinteger]]## value.

{{fbdoc item="ret"}}
Returns the value of the low word of //expr//.

{{fbdoc item="desc"}}
This macro converts the numeric expression ##//expr//## to an ##[[KeyPgUinteger|Uinteger]]## value, then expands to an ##[[KeyPgUinteger|Uinteger]]## representing the value of its least-significant (low) 16bit word.

{{fbdoc item="ex"}}
{{fbdoc item="filename" value="examples/manual/bits/loword.bas"}}%%(freebasic)
DIM N AS UINTEGER

'Note there are 32 bits
N = &b10000000000000011111111111111111

PRINT "N is "; N
PRINT "The binary representation of N is "; BIN(N)
PRINT "The most significant word (MSW) of N is "; HIWORD(N)
PRINT "The least significant word (LSW) of N is "; LOWORD(N)
PRINT "The binary representation of the MSW is "; BIN(HIWORD(N))
PRINT "The binary representation of the LSW is "; BIN(LOWORD(N))

SLEEP
%%

The output would look like:
%%
N Is 2147614719
The Binary representation of N Is 10000000000000011111111111111111
The most significant word (MSW) of N Is 32769
The least significant word (LSW) of N Is 65535
The Binary representation of the MSW Is 1000000000000001
The Binary representation of the LSW Is 1111111111111111
%%


{{fbdoc item="lang"}}
- Not available in the //[[CompilerOptlang|-lang qb]]// dialect unless referenced with the alias ##**""__LOWORD""**##.

{{fbdoc item="diff"}}
- New to ""FreeBASIC""

{{fbdoc item="see"}}
- ##[[KeyPgLoByte|Lobyte]]##
- ##[[KeyPgHibyte|Hibyte]]##
- ##[[KeyPgHiword|Hiword]]##

{{fbdoc item="back" value="CatPgBits|Bit Manipulation"}}
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode