Skip to content
Narta Xaymar Dirks edited this page Oct 28, 2026 · 6 revisions
BlitzLLVM

RotL 〔BlitzLLVM〕

RotL:Int32 value:Int32, count:Int32
Parameter Mode Type Default Description
value In Int32 required An integer.
count In Int32 required How many bits to turn by.

Returns: The number with its bits turned.

Description

〔BlitzLLVM〕 This command does not exist in the original Blitz products. BlitzLLVM adds it.

Turns the bits of a number to the left, and the bits that leave on the left come in on the right. The result has the type of the number, and the count is taken modulo the number of bits, so turning an Int by 32 changes nothing and a count of -1 turns it the other way around. This is a BlitzLLVM extension. It looks at the bits of the number the way its type has them, so the same value counts differently as a Byte, an Int or a Long: a number written in the program is an Int (32 bits) unless it is larger, and Byte, UByte, Short, UShort, UInt, Long and ULong give the other widths. A real or a text is taken as an Int, like the bit operators do.

Differences

  • Not in the originals, which have Shl, Shr and Sar only.

Examples

Print RotL(UByte($81), 1)
Print RotL($80000001, 4)
Print RotL(ULong(1) Shl 63, 1)
3
24
1

Related Commands

Pi, PopCount 〔BlitzLLVM〕, RotR 〔BlitzLLVM〕, SatByte 〔BlitzLLVM〕

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally