<number> = <number> << <number>
Shift left-side Glossary: number, num_valnumber bitwise left right-side Glossary: number, num_valnumber times.
List functions: thisThis may yield a fractional Glossary: number, num_valnumber! Flow control: if … then Flow control: try … thenThe right-side Glossary: Operator Glossary: Operandoperand may be negative but Operators: Bitwise Not "~" Operators: Boolean Negation "!"not fractional. It will be forced to an integer. List functions: thisThis works for any Glossary: number, num_valnumber of any size, even fractional Data Types: Numbersnumbers. Flow control: if … then Flow control: try … thenThe effect is that of multiplying Flow control: if … then Flow control: try … thenthe Glossary: Variable, var_refvariable by a power of 2, Operators: Boolean Or with Variable "||=" Operators: Bitwise Or with Variable "|=" Operators: Bitwise Or "|" Operators: Boolean Or "||"or, more techi, incrementing Flow control: if … then Flow control: try … thenthe Number literals: Floating pointfloating point exponent by Flow control: if … then Flow control: try … thenthe given Glossary: number, num_valnumber.
Flow control: if … thenIf any of both Vipsi command syntax: Arguments Glossary: Argumentsarguments is a Data Types: Text Item selector "[]": Text Glossary: text, text_valtext, Flow control: if … then Flow control: try … thenthen it is evaluated as Glossary: number, num_valnumber.
Flow control: if … thenIf any of both is a Data Types: Lists and arrays Item selector "[]": Lists Glossary: list, list_vallist, Flow control: if … then Flow control: try … thenthen Flow control: if … then Flow control: try … thenthe operation is performed on all items. Recursively.
e.g.:
vipsi> Instructions: putput 8<<2 32
vipsi>
Operators: Bitwise Not "~" Operators: Boolean Negation "!"note:
Flow control: if … then Flow control: try … thenThe shift Vipsi command syntax: Operators Operators Glossary: Operatoroperator multiplies/Operators: Divide with Variable "/=" Operators: Divide "/"divides Flow control: if … then Flow control: try … thenthe Glossary: number, num_valnumber by a power of 2. List functions: thisThis is also true for negative Data Types: Numbersnumbers. Flow control: if … thenIf you expect a negative Glossary: number, num_valnumber to be stored as a -1 Operators: Bitwise Not "~"complement (as is common for Number literals: Integer numbersinteger numbers) you will fail here. Make Flow control: if … then Flow control: try … thenthe Glossary: number, num_valnumber positive Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and force it into desired range by masking it with Vipsi command syntax: Operators Operators Glossary: Operatoroperator &.
vipsi> Instructions: putput -8<<2 -32
vipsi> Instructions: var How does VScript::Value() work?: Var*&var a=-8
vipsi> Instructions: putput (a&$ffff)<<2 262112
vipsi> Instructions: putput Text functions: hexstrhexstr((a&$ffff)<<2,4) FFE0
|