Wiki source for KeyPgOpCombineShiftRight


Show raw source

{{fbdoc item="title" value="Operator Shr= (Shift right and Assign)"}}----
Shifts right and assigns a value to a variable

{{fbdoc item="syntax"}}##
[[KeyPgDeclare|declare]] [[KeyPgOperator|operator]] **Shr=** ( [[KeyPgByref|byref]] //lhs// [[KeyPgAs|as]] [[KeyPgInteger|integer]], [[KeyPgByref|byref]] //rhs// [[KeyPgAs|as]] [[KeyPgInteger|integer]] )
[[KeyPgDeclare|declare]] [[KeyPgOperator|operator]] **Shr=** ( [[KeyPgByref|byref]] //lhs// [[KeyPgAs|as]] [[KeyPgUinteger|uinteger]], [[KeyPgByref|byref]] //rhs// [[KeyPgAs|as]] [[KeyPgUinteger|uinteger]] )
[[KeyPgDeclare|declare]] [[KeyPgOperator|operator]] **Shr=** ( [[KeyPgByref|byref]] //lhs// [[KeyPgAs|as]] [[KeyPgLongint|longint]], [[KeyPgByref|byref]] //rhs// [[KeyPgAs|as]] [[KeyPgLongint|longint]] )
[[KeyPgDeclare|declare]] [[KeyPgOperator|operator]] **Shr=** ( [[KeyPgByref|byref]] //lhs// [[KeyPgAs|as]] [[KeyPgUlongint|ulongint]], [[KeyPgByref|byref]] //rhs// [[KeyPgAs|as]] [[KeyPgUlongint|ulongint]] )
##
{{fbdoc item="usage"}}##
//lhs// **shr=** //rhs//
##
{{fbdoc item="param"}}
##//lhs//##
The variable to assign to.
##//rhs//##
The value to shift ##//lhs//## right by.

{{fbdoc item="desc"}}
This operator shifts the bits in its left-hand side (##//lhs//##) parameter a number of times specified by its right-hand side (##//rhs//##) parameter, and assigns the result to ##//lhs//##. It is functionally equivalent to:
##//lhs// = //lhs// [[KeyPgOpShiftRight|Shr]] //rhs//##

This operator can be overloaded for user-defined types as a member ##[[KeyPgOperator|Operator]]## using the appropriate syntax.

//Note: Similarly to the operator '=[>]' (assign), the alternative symbol 'Shr=>' can be also used.//

{{fbdoc item="ex"}}
{{fbdoc item="filename" value="examples/manual/operator/shr-assign.bas"}}%%(freebasic)
DIM i AS INTEGER
i = &b00011000 '' = 24
i shr= 3 '' = i\2^3
'' Result: 11 3 3
print bin(i), i, 24\2^3
SLEEP
%%

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

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

{{fbdoc item="see"}}
- ##[[KeyPgOpShiftRight|Operator Shr (Shift right)]]##
- ##[[KeyPgOpCombineShiftLeft|Operator Shl= (Shift Left and Assign)]]##
- [[CatPgMath|Mathematical Functions]]

{{fbdoc item="back" value="CatPgOpAssignment|Assignment Operators"}}{{fbdoc item="back" value="CatPgOperators|Operators"}}
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode