Operator: &>>

operator &>> { associativity precedence }

Declarations

func &>>(_: Int, rhs: Int)

Returns the result of shifting a value's binary representation the specified number of digits to the right, masking the shift amount to the type's bit width.

Use the masking right shift operator (&>>) when you need to perform a shift and are sure that the shift amount is in the range 0..<lhs.bitWidth. Before shifting, the masking right shift operator masks the shift to this range. The shift is performed using this masked value.

The following example defines x as an instance of UInt8, an 8-bit, unsigned integer type. If you use 2 as the right-hand-side value in an operation on x, the shift amount requires no masking.

let x: UInt8 = 30                 // 0b00011110
let y = x &>> 2
// y == 7                         // 0b00000111

However, if you use 8 as the shift amount, the method first masks the shift amount to zero, and then performs the shift, resulting in no change to the original value.

let z = x &>> 8
// z == 30                        // 0b00011110

If the bit width of the shifted integer type is a power of two, masking is performed using a bitmask; otherwise, masking is performed using a modulo operation.

Parameters: lhs: The value to shift. rhs: The number of bits to shift lhs to the right. If rhs is outside the range 0..<lhs.bitWidth, it is masked to produce a value within that range.

Declaration

func &>>(lhs: Int, rhs: Int) -> Int
func &>>(_: Int8, rhs: Int8)

Returns the result of shifting a value's binary representation the specified number of digits to the right, masking the shift amount to the type's bit width.

Use the masking right shift operator (&>>) when you need to perform a shift and are sure that the shift amount is in the range 0..<lhs.bitWidth. Before shifting, the masking right shift operator masks the shift to this range. The shift is performed using this masked value.

The following example defines x as an instance of UInt8, an 8-bit, unsigned integer type. If you use 2 as the right-hand-side value in an operation on x, the shift amount requires no masking.

let x: UInt8 = 30                 // 0b00011110
let y = x &>> 2
// y == 7                         // 0b00000111

However, if you use 8 as the shift amount, the method first masks the shift amount to zero, and then performs the shift, resulting in no change to the original value.

let z = x &>> 8
// z == 30                        // 0b00011110

If the bit width of the shifted integer type is a power of two, masking is performed using a bitmask; otherwise, masking is performed using a modulo operation.

Parameters: lhs: The value to shift. rhs: The number of bits to shift lhs to the right. If rhs is outside the range 0..<lhs.bitWidth, it is masked to produce a value within that range.

Declaration

func &>>(lhs: Int8, rhs: Int8) -> Int8
func &>>(_: Int16, rhs: Int16)

Returns the result of shifting a value's binary representation the specified number of digits to the right, masking the shift amount to the type's bit width.

Use the masking right shift operator (&>>) when you need to perform a shift and are sure that the shift amount is in the range 0..<lhs.bitWidth. Before shifting, the masking right shift operator masks the shift to this range. The shift is performed using this masked value.

The following example defines x as an instance of UInt8, an 8-bit, unsigned integer type. If you use 2 as the right-hand-side value in an operation on x, the shift amount requires no masking.

let x: UInt8 = 30                 // 0b00011110
let y = x &>> 2
// y == 7                         // 0b00000111

However, if you use 8 as the shift amount, the method first masks the shift amount to zero, and then performs the shift, resulting in no change to the original value.

let z = x &>> 8
// z == 30                        // 0b00011110

If the bit width of the shifted integer type is a power of two, masking is performed using a bitmask; otherwise, masking is performed using a modulo operation.

Parameters: lhs: The value to shift. rhs: The number of bits to shift lhs to the right. If rhs is outside the range 0..<lhs.bitWidth, it is masked to produce a value within that range.

Declaration

func &>>(lhs: Int16, rhs: Int16) -> Int16
func &>>(_: Int32, rhs: Int32)

Returns the result of shifting a value's binary representation the specified number of digits to the right, masking the shift amount to the type's bit width.

Use the masking right shift operator (&>>) when you need to perform a shift and are sure that the shift amount is in the range 0..<lhs.bitWidth. Before shifting, the masking right shift operator masks the shift to this range. The shift is performed using this masked value.

The following example defines x as an instance of UInt8, an 8-bit, unsigned integer type. If you use 2 as the right-hand-side value in an operation on x, the shift amount requires no masking.

let x: UInt8 = 30                 // 0b00011110
let y = x &>> 2
// y == 7                         // 0b00000111

However, if you use 8 as the shift amount, the method first masks the shift amount to zero, and then performs the shift, resulting in no change to the original value.

let z = x &>> 8
// z == 30                        // 0b00011110

If the bit width of the shifted integer type is a power of two, masking is performed using a bitmask; otherwise, masking is performed using a modulo operation.

Parameters: lhs: The value to shift. rhs: The number of bits to shift lhs to the right. If rhs is outside the range 0..<lhs.bitWidth, it is masked to produce a value within that range.

Declaration

func &>>(lhs: Int32, rhs: Int32) -> Int32
func &>>(_: Int64, rhs: Int64)

Returns the result of shifting a value's binary representation the specified number of digits to the right, masking the shift amount to the type's bit width.

Use the masking right shift operator (&>>) when you need to perform a shift and are sure that the shift amount is in the range 0..<lhs.bitWidth. Before shifting, the masking right shift operator masks the shift to this range. The shift is performed using this masked value.

The following example defines x as an instance of UInt8, an 8-bit, unsigned integer type. If you use 2 as the right-hand-side value in an operation on x, the shift amount requires no masking.

let x: UInt8 = 30                 // 0b00011110
let y = x &>> 2
// y == 7                         // 0b00000111

However, if you use 8 as the shift amount, the method first masks the shift amount to zero, and then performs the shift, resulting in no change to the original value.

let z = x &>> 8
// z == 30                        // 0b00011110

If the bit width of the shifted integer type is a power of two, masking is performed using a bitmask; otherwise, masking is performed using a modulo operation.

Parameters: lhs: The value to shift. rhs: The number of bits to shift lhs to the right. If rhs is outside the range 0..<lhs.bitWidth, it is masked to produce a value within that range.

Declaration

func &>>(lhs: Int64, rhs: Int64) -> Int64
func &>>(_: Self, rhs: Self)

Returns the result of shifting a value's binary representation the specified number of digits to the right, masking the shift amount to the type's bit width.

Use the masking right shift operator (&>>) when you need to perform a shift and are sure that the shift amount is in the range 0..<lhs.bitWidth. Before shifting, the masking right shift operator masks the shift to this range. The shift is performed using this masked value.

The following example defines x as an instance of UInt8, an 8-bit, unsigned integer type. If you use 2 as the right-hand-side value in an operation on x, the shift amount requires no masking.

let x: UInt8 = 30                 // 0b00011110
let y = x &>> 2
// y == 7                         // 0b00000111

However, if you use 8 as the shift amount, the method first masks the shift amount to zero, and then performs the shift, resulting in no change to the original value.

let z = x &>> 8
// z == 30                        // 0b00011110

If the bit width of the shifted integer type is a power of two, masking is performed using a bitmask; otherwise, masking is performed using a modulo operation.

Parameters: lhs: The value to shift. rhs: The number of bits to shift lhs to the right. If rhs is outside the range 0..<lhs.bitWidth, it is masked to produce a value within that range.

Declaration

func &>>(lhs: Self, rhs: Self) -> Self

Declared In

FixedWidthInteger
func &>>(_: Self, rhs: Self)

Returns the result of shifting a value's binary representation the specified number of digits to the right, masking the shift amount to the type's bit width.

Use the masking right shift operator (&>>) when you need to perform a shift and are sure that the shift amount is in the range 0..<lhs.bitWidth. Before shifting, the masking right shift operator masks the shift to this range. The shift is performed using this masked value.

The following example defines x as an instance of UInt8, an 8-bit, unsigned integer type. If you use 2 as the right-hand-side value in an operation on x, the shift amount requires no masking.

let x: UInt8 = 30                 // 0b00011110
let y = x &>> 2
// y == 7                         // 0b00000111

However, if you use 8 as the shift amount, the method first masks the shift amount to zero, and then performs the shift, resulting in no change to the original value.

let z = x &>> 8
// z == 30                        // 0b00011110

If the bit width of the shifted integer type is a power of two, masking is performed using a bitmask; otherwise, masking is performed using a modulo operation.

Parameters: lhs: The value to shift. rhs: The number of bits to shift lhs to the right. If rhs is outside the range 0..<lhs.bitWidth, it is masked to produce a value within that range.

Declaration

func &>>(lhs: Self, rhs: Self) -> Self

Declared In

FixedWidthInteger
func &>>(_: Self, rhs: Self)

Returns the result of shifting a value's binary representation the specified number of digits to the right, masking the shift amount to the type's bit width.

Use the masking right shift operator (&>>) when you need to perform a shift and are sure that the shift amount is in the range 0..<lhs.bitWidth. Before shifting, the masking right shift operator masks the shift to this range. The shift is performed using this masked value.

The following example defines x as an instance of UInt8, an 8-bit, unsigned integer type. If you use 2 as the right-hand-side value in an operation on x, the shift amount requires no masking.

let x: UInt8 = 30                 // 0b00011110
let y = x &>> 2
// y == 7                         // 0b00000111

However, if you use 8 as the shift amount, the method first masks the shift amount to zero, and then performs the shift, resulting in no change to the original value.

let z = x &>> 8
// z == 30                        // 0b00011110

If the bit width of the shifted integer type is a power of two, masking is performed using a bitmask; otherwise, masking is performed using a modulo operation.

Parameters: lhs: The value to shift. rhs: The number of bits to shift lhs to the right. If rhs is outside the range 0..<lhs.bitWidth, it is masked to produce a value within that range.

Declaration

func &>>(lhs: Self, rhs: Self) -> Self

Declared In

FixedWidthInteger
func &>>(_: Self, rhs: Self)

Returns the result of shifting a value's binary representation the specified number of digits to the right, masking the shift amount to the type's bit width.

Use the masking right shift operator (&>>) when you need to perform a shift and are sure that the shift amount is in the range 0..<lhs.bitWidth. Before shifting, the masking right shift operator masks the shift to this range. The shift is performed using this masked value.

The following example defines x as an instance of UInt8, an 8-bit, unsigned integer type. If you use 2 as the right-hand-side value in an operation on x, the shift amount requires no masking.

let x: UInt8 = 30                 // 0b00011110
let y = x &>> 2
// y == 7                         // 0b00000111

However, if you use 8 as the shift amount, the method first masks the shift amount to zero, and then performs the shift, resulting in no change to the original value.

let z = x &>> 8
// z == 30                        // 0b00011110

If the bit width of the shifted integer type is a power of two, masking is performed using a bitmask; otherwise, masking is performed using a modulo operation.

Parameters: lhs: The value to shift. rhs: The number of bits to shift lhs to the right. If rhs is outside the range 0..<lhs.bitWidth, it is masked to produce a value within that range.

Declaration

func &>>(lhs: Self, rhs: Self) -> Self

Declared In

FixedWidthInteger
func &>>(_: Self, rhs: Self)

Returns the result of shifting a value's binary representation the specified number of digits to the right, masking the shift amount to the type's bit width.

Use the masking right shift operator (&>>) when you need to perform a shift and are sure that the shift amount is in the range 0..<lhs.bitWidth. Before shifting, the masking right shift operator masks the shift to this range. The shift is performed using this masked value.

The following example defines x as an instance of UInt8, an 8-bit, unsigned integer type. If you use 2 as the right-hand-side value in an operation on x, the shift amount requires no masking.

let x: UInt8 = 30                 // 0b00011110
let y = x &>> 2
// y == 7                         // 0b00000111

However, if you use 8 as the shift amount, the method first masks the shift amount to zero, and then performs the shift, resulting in no change to the original value.

let z = x &>> 8
// z == 30                        // 0b00011110

If the bit width of the shifted integer type is a power of two, masking is performed using a bitmask; otherwise, masking is performed using a modulo operation.

Parameters: lhs: The value to shift. rhs: The number of bits to shift lhs to the right. If rhs is outside the range 0..<lhs.bitWidth, it is masked to produce a value within that range.

Declaration

func &>>(lhs: Self, rhs: Self) -> Self

Declared In

FixedWidthInteger
func &>>(_: Self, rhs: Self)

Returns the result of shifting a value's binary representation the specified number of digits to the right, masking the shift amount to the type's bit width.

Use the masking right shift operator (&>>) when you need to perform a shift and are sure that the shift amount is in the range 0..<lhs.bitWidth. Before shifting, the masking right shift operator masks the shift to this range. The shift is performed using this masked value.

The following example defines x as an instance of UInt8, an 8-bit, unsigned integer type. If you use 2 as the right-hand-side value in an operation on x, the shift amount requires no masking.

let x: UInt8 = 30                 // 0b00011110
let y = x &>> 2
// y == 7                         // 0b00000111

However, if you use 8 as the shift amount, the method first masks the shift amount to zero, and then performs the shift, resulting in no change to the original value.

let z = x &>> 8
// z == 30                        // 0b00011110

If the bit width of the shifted integer type is a power of two, masking is performed using a bitmask; otherwise, masking is performed using a modulo operation.

Parameters: lhs: The value to shift. rhs: The number of bits to shift lhs to the right. If rhs is outside the range 0..<lhs.bitWidth, it is masked to produce a value within that range.

Declaration

func &>>(lhs: Self, rhs: Self) -> Self

Declared In

FixedWidthInteger
func &>>(_: Self, rhs: Self)

Returns the result of shifting a value's binary representation the specified number of digits to the right, masking the shift amount to the type's bit width.

Use the masking right shift operator (&>>) when you need to perform a shift and are sure that the shift amount is in the range 0..<lhs.bitWidth. Before shifting, the masking right shift operator masks the shift to this range. The shift is performed using this masked value.

The following example defines x as an instance of UInt8, an 8-bit, unsigned integer type. If you use 2 as the right-hand-side value in an operation on x, the shift amount requires no masking.

let x: UInt8 = 30                 // 0b00011110
let y = x &>> 2
// y == 7                         // 0b00000111

However, if you use 8 as the shift amount, the method first masks the shift amount to zero, and then performs the shift, resulting in no change to the original value.

let z = x &>> 8
// z == 30                        // 0b00011110

If the bit width of the shifted integer type is a power of two, masking is performed using a bitmask; otherwise, masking is performed using a modulo operation.

Parameters: lhs: The value to shift. rhs: The number of bits to shift lhs to the right. If rhs is outside the range 0..<lhs.bitWidth, it is masked to produce a value within that range.

Declaration

func &>>(lhs: Self, rhs: Self) -> Self

Declared In

FixedWidthInteger
func &>>(_: Self, rhs: Self)

Returns the result of shifting a value's binary representation the specified number of digits to the right, masking the shift amount to the type's bit width.

Use the masking right shift operator (&>>) when you need to perform a shift and are sure that the shift amount is in the range 0..<lhs.bitWidth. Before shifting, the masking right shift operator masks the shift to this range. The shift is performed using this masked value.

The following example defines x as an instance of UInt8, an 8-bit, unsigned integer type. If you use 2 as the right-hand-side value in an operation on x, the shift amount requires no masking.

let x: UInt8 = 30                 // 0b00011110
let y = x &>> 2
// y == 7                         // 0b00000111

However, if you use 8 as the shift amount, the method first masks the shift amount to zero, and then performs the shift, resulting in no change to the original value.

let z = x &>> 8
// z == 30                        // 0b00011110

If the bit width of the shifted integer type is a power of two, masking is performed using a bitmask; otherwise, masking is performed using a modulo operation.

Parameters: lhs: The value to shift. rhs: The number of bits to shift lhs to the right. If rhs is outside the range 0..<lhs.bitWidth, it is masked to produce a value within that range.

Declaration

func &>>(lhs: Self, rhs: Self) -> Self

Declared In

FixedWidthInteger
func &>>(_: Self, rhs: Self)

Returns the result of shifting a value's binary representation the specified number of digits to the right, masking the shift amount to the type's bit width.

Use the masking right shift operator (&>>) when you need to perform a shift and are sure that the shift amount is in the range 0..<lhs.bitWidth. Before shifting, the masking right shift operator masks the shift to this range. The shift is performed using this masked value.

The following example defines x as an instance of UInt8, an 8-bit, unsigned integer type. If you use 2 as the right-hand-side value in an operation on x, the shift amount requires no masking.

let x: UInt8 = 30                 // 0b00011110
let y = x &>> 2
// y == 7                         // 0b00000111

However, if you use 8 as the shift amount, the method first masks the shift amount to zero, and then performs the shift, resulting in no change to the original value.

let z = x &>> 8
// z == 30                        // 0b00011110

If the bit width of the shifted integer type is a power of two, masking is performed using a bitmask; otherwise, masking is performed using a modulo operation.

Parameters: lhs: The value to shift. rhs: The number of bits to shift lhs to the right. If rhs is outside the range 0..<lhs.bitWidth, it is masked to produce a value within that range.

Declaration

func &>>(lhs: Self, rhs: Self) -> Self

Declared In

FixedWidthInteger
func &>>(_: Self, rhs: Self)

Returns the result of shifting a value's binary representation the specified number of digits to the right, masking the shift amount to the type's bit width.

Use the masking right shift operator (&>>) when you need to perform a shift and are sure that the shift amount is in the range 0..<lhs.bitWidth. Before shifting, the masking right shift operator masks the shift to this range. The shift is performed using this masked value.

The following example defines x as an instance of UInt8, an 8-bit, unsigned integer type. If you use 2 as the right-hand-side value in an operation on x, the shift amount requires no masking.

let x: UInt8 = 30                 // 0b00011110
let y = x &>> 2
// y == 7                         // 0b00000111

However, if you use 8 as the shift amount, the method first masks the shift amount to zero, and then performs the shift, resulting in no change to the original value.

let z = x &>> 8
// z == 30                        // 0b00011110

If the bit width of the shifted integer type is a power of two, masking is performed using a bitmask; otherwise, masking is performed using a modulo operation.

Parameters: lhs: The value to shift. rhs: The number of bits to shift lhs to the right. If rhs is outside the range 0..<lhs.bitWidth, it is masked to produce a value within that range.

Declaration

func &>>(lhs: Self, rhs: Self) -> Self

Declared In

FixedWidthInteger
func &>>(_: UInt, rhs: UInt)

Returns the result of shifting a value's binary representation the specified number of digits to the right, masking the shift amount to the type's bit width.

Use the masking right shift operator (&>>) when you need to perform a shift and are sure that the shift amount is in the range 0..<lhs.bitWidth. Before shifting, the masking right shift operator masks the shift to this range. The shift is performed using this masked value.

The following example defines x as an instance of UInt8, an 8-bit, unsigned integer type. If you use 2 as the right-hand-side value in an operation on x, the shift amount requires no masking.

let x: UInt8 = 30                 // 0b00011110
let y = x &>> 2
// y == 7                         // 0b00000111

However, if you use 8 as the shift amount, the method first masks the shift amount to zero, and then performs the shift, resulting in no change to the original value.

let z = x &>> 8
// z == 30                        // 0b00011110

If the bit width of the shifted integer type is a power of two, masking is performed using a bitmask; otherwise, masking is performed using a modulo operation.

Parameters: lhs: The value to shift. rhs: The number of bits to shift lhs to the right. If rhs is outside the range 0..<lhs.bitWidth, it is masked to produce a value within that range.

Declaration

func &>>(lhs: UInt, rhs: UInt) -> UInt
func &>>(_: UInt8, rhs: UInt8)

Returns the result of shifting a value's binary representation the specified number of digits to the right, masking the shift amount to the type's bit width.

Use the masking right shift operator (&>>) when you need to perform a shift and are sure that the shift amount is in the range 0..<lhs.bitWidth. Before shifting, the masking right shift operator masks the shift to this range. The shift is performed using this masked value.

The following example defines x as an instance of UInt8, an 8-bit, unsigned integer type. If you use 2 as the right-hand-side value in an operation on x, the shift amount requires no masking.

let x: UInt8 = 30                 // 0b00011110
let y = x &>> 2
// y == 7                         // 0b00000111

However, if you use 8 as the shift amount, the method first masks the shift amount to zero, and then performs the shift, resulting in no change to the original value.

let z = x &>> 8
// z == 30                        // 0b00011110

If the bit width of the shifted integer type is a power of two, masking is performed using a bitmask; otherwise, masking is performed using a modulo operation.

Parameters: lhs: The value to shift. rhs: The number of bits to shift lhs to the right. If rhs is outside the range 0..<lhs.bitWidth, it is masked to produce a value within that range.

Declaration

func &>>(lhs: UInt8, rhs: UInt8) -> UInt8
func &>>(_: UInt16, rhs: UInt16)

Returns the result of shifting a value's binary representation the specified number of digits to the right, masking the shift amount to the type's bit width.

Use the masking right shift operator (&>>) when you need to perform a shift and are sure that the shift amount is in the range 0..<lhs.bitWidth. Before shifting, the masking right shift operator masks the shift to this range. The shift is performed using this masked value.

The following example defines x as an instance of UInt8, an 8-bit, unsigned integer type. If you use 2 as the right-hand-side value in an operation on x, the shift amount requires no masking.

let x: UInt8 = 30                 // 0b00011110
let y = x &>> 2
// y == 7                         // 0b00000111

However, if you use 8 as the shift amount, the method first masks the shift amount to zero, and then performs the shift, resulting in no change to the original value.

let z = x &>> 8
// z == 30                        // 0b00011110

If the bit width of the shifted integer type is a power of two, masking is performed using a bitmask; otherwise, masking is performed using a modulo operation.

Parameters: lhs: The value to shift. rhs: The number of bits to shift lhs to the right. If rhs is outside the range 0..<lhs.bitWidth, it is masked to produce a value within that range.

Declaration

func &>>(lhs: UInt16, rhs: UInt16) -> UInt16
func &>>(_: UInt32, rhs: UInt32)

Returns the result of shifting a value's binary representation the specified number of digits to the right, masking the shift amount to the type's bit width.

Use the masking right shift operator (&>>) when you need to perform a shift and are sure that the shift amount is in the range 0..<lhs.bitWidth. Before shifting, the masking right shift operator masks the shift to this range. The shift is performed using this masked value.

The following example defines x as an instance of UInt8, an 8-bit, unsigned integer type. If you use 2 as the right-hand-side value in an operation on x, the shift amount requires no masking.

let x: UInt8 = 30                 // 0b00011110
let y = x &>> 2
// y == 7                         // 0b00000111

However, if you use 8 as the shift amount, the method first masks the shift amount to zero, and then performs the shift, resulting in no change to the original value.

let z = x &>> 8
// z == 30                        // 0b00011110

If the bit width of the shifted integer type is a power of two, masking is performed using a bitmask; otherwise, masking is performed using a modulo operation.

Parameters: lhs: The value to shift. rhs: The number of bits to shift lhs to the right. If rhs is outside the range 0..<lhs.bitWidth, it is masked to produce a value within that range.

Declaration

func &>>(lhs: UInt32, rhs: UInt32) -> UInt32
func &>>(_: UInt64, rhs: UInt64)

Returns the result of shifting a value's binary representation the specified number of digits to the right, masking the shift amount to the type's bit width.

Use the masking right shift operator (&>>) when you need to perform a shift and are sure that the shift amount is in the range 0..<lhs.bitWidth. Before shifting, the masking right shift operator masks the shift to this range. The shift is performed using this masked value.

The following example defines x as an instance of UInt8, an 8-bit, unsigned integer type. If you use 2 as the right-hand-side value in an operation on x, the shift amount requires no masking.

let x: UInt8 = 30                 // 0b00011110
let y = x &>> 2
// y == 7                         // 0b00000111

However, if you use 8 as the shift amount, the method first masks the shift amount to zero, and then performs the shift, resulting in no change to the original value.

let z = x &>> 8
// z == 30                        // 0b00011110

If the bit width of the shifted integer type is a power of two, masking is performed using a bitmask; otherwise, masking is performed using a modulo operation.

Parameters: lhs: The value to shift. rhs: The number of bits to shift lhs to the right. If rhs is outside the range 0..<lhs.bitWidth, it is masked to produce a value within that range.

Declaration

func &>>(lhs: UInt64, rhs: UInt64) -> UInt64
func &>> <Other>(_: Self, rhs: Other)

Returns the result of shifting a value's binary representation the specified number of digits to the right, masking the shift amount to the type's bit width.

Use the masking right shift operator (&>>) when you need to perform a shift and are sure that the shift amount is in the range 0..<lhs.bitWidth. Before shifting, the masking right shift operator masks the shift to this range. The shift is performed using this masked value.

The following example defines x as an instance of UInt8, an 8-bit, unsigned integer type. If you use 2 as the right-hand-side value in an operation on x, the shift amount requires no masking.

let x: UInt8 = 30                 // 0b00011110
let y = x &>> 2
// y == 7                         // 0b00000111

However, if you use 8 as the shift amount, the method first masks the shift amount to zero, and then performs the shift, resulting in no change to the original value.

let z = x &>> 8
// z == 30                        // 0b00011110

If the bit width of the shifted integer type is a power of two, masking is performed using a bitmask; otherwise, masking is performed using a modulo operation.

Parameters: lhs: The value to shift. rhs: The number of bits to shift lhs to the right. If rhs is outside the range 0..<lhs.bitWidth, it is masked to produce a value within that range.

Declaration

func &>><Other>(lhs: Self, rhs: Other) -> Self where Other : BinaryInteger

Declared In

FixedWidthInteger
func &>> <Other>(_: Self, rhs: Other)

Returns the result of shifting a value's binary representation the specified number of digits to the right, masking the shift amount to the type's bit width.

Use the masking right shift operator (&>>) when you need to perform a shift and are sure that the shift amount is in the range 0..<lhs.bitWidth. Before shifting, the masking right shift operator masks the shift to this range. The shift is performed using this masked value.

The following example defines x as an instance of UInt8, an 8-bit, unsigned integer type. If you use 2 as the right-hand-side value in an operation on x, the shift amount requires no masking.

let x: UInt8 = 30                 // 0b00011110
let y = x &>> 2
// y == 7                         // 0b00000111

However, if you use 8 as the shift amount, the method first masks the shift amount to zero, and then performs the shift, resulting in no change to the original value.

let z = x &>> 8
// z == 30                        // 0b00011110

If the bit width of the shifted integer type is a power of two, masking is performed using a bitmask; otherwise, masking is performed using a modulo operation.

Parameters: lhs: The value to shift. rhs: The number of bits to shift lhs to the right. If rhs is outside the range 0..<lhs.bitWidth, it is masked to produce a value within that range.

Declaration

func &>><Other>(lhs: Self, rhs: Other) -> Self where Other : BinaryInteger

Declared In

FixedWidthInteger
func &>> <Other>(_: Self, rhs: Other)

Returns the result of shifting a value's binary representation the specified number of digits to the right, masking the shift amount to the type's bit width.

Use the masking right shift operator (&>>) when you need to perform a shift and are sure that the shift amount is in the range 0..<lhs.bitWidth. Before shifting, the masking right shift operator masks the shift to this range. The shift is performed using this masked value.

The following example defines x as an instance of UInt8, an 8-bit, unsigned integer type. If you use 2 as the right-hand-side value in an operation on x, the shift amount requires no masking.

let x: UInt8 = 30                 // 0b00011110
let y = x &>> 2
// y == 7                         // 0b00000111

However, if you use 8 as the shift amount, the method first masks the shift amount to zero, and then performs the shift, resulting in no change to the original value.

let z = x &>> 8
// z == 30                        // 0b00011110

If the bit width of the shifted integer type is a power of two, masking is performed using a bitmask; otherwise, masking is performed using a modulo operation.

Parameters: lhs: The value to shift. rhs: The number of bits to shift lhs to the right. If rhs is outside the range 0..<lhs.bitWidth, it is masked to produce a value within that range.

Declaration

func &>><Other>(lhs: Self, rhs: Other) -> Self where Other : BinaryInteger

Declared In

FixedWidthInteger
func &>> <Other>(_: Self, rhs: Other)

Returns the result of shifting a value's binary representation the specified number of digits to the right, masking the shift amount to the type's bit width.

Use the masking right shift operator (&>>) when you need to perform a shift and are sure that the shift amount is in the range 0..<lhs.bitWidth. Before shifting, the masking right shift operator masks the shift to this range. The shift is performed using this masked value.

The following example defines x as an instance of UInt8, an 8-bit, unsigned integer type. If you use 2 as the right-hand-side value in an operation on x, the shift amount requires no masking.

let x: UInt8 = 30                 // 0b00011110
let y = x &>> 2
// y == 7                         // 0b00000111

However, if you use 8 as the shift amount, the method first masks the shift amount to zero, and then performs the shift, resulting in no change to the original value.

let z = x &>> 8
// z == 30                        // 0b00011110

If the bit width of the shifted integer type is a power of two, masking is performed using a bitmask; otherwise, masking is performed using a modulo operation.

Parameters: lhs: The value to shift. rhs: The number of bits to shift lhs to the right. If rhs is outside the range 0..<lhs.bitWidth, it is masked to produce a value within that range.

Declaration

func &>><Other>(lhs: Self, rhs: Other) -> Self where Other : BinaryInteger

Declared In

FixedWidthInteger
func &>> <Other>(_: Self, rhs: Other)

Returns the result of shifting a value's binary representation the specified number of digits to the right, masking the shift amount to the type's bit width.

Use the masking right shift operator (&>>) when you need to perform a shift and are sure that the shift amount is in the range 0..<lhs.bitWidth. Before shifting, the masking right shift operator masks the shift to this range. The shift is performed using this masked value.

The following example defines x as an instance of UInt8, an 8-bit, unsigned integer type. If you use 2 as the right-hand-side value in an operation on x, the shift amount requires no masking.

let x: UInt8 = 30                 // 0b00011110
let y = x &>> 2
// y == 7                         // 0b00000111

However, if you use 8 as the shift amount, the method first masks the shift amount to zero, and then performs the shift, resulting in no change to the original value.

let z = x &>> 8
// z == 30                        // 0b00011110

If the bit width of the shifted integer type is a power of two, masking is performed using a bitmask; otherwise, masking is performed using a modulo operation.

Parameters: lhs: The value to shift. rhs: The number of bits to shift lhs to the right. If rhs is outside the range 0..<lhs.bitWidth, it is masked to produce a value within that range.

Declaration

func &>><Other>(lhs: Self, rhs: Other) -> Self where Other : BinaryInteger

Declared In

FixedWidthInteger
func &>> <Other>(_: Self, rhs: Other)

Returns the result of shifting a value's binary representation the specified number of digits to the right, masking the shift amount to the type's bit width.

Use the masking right shift operator (&>>) when you need to perform a shift and are sure that the shift amount is in the range 0..<lhs.bitWidth. Before shifting, the masking right shift operator masks the shift to this range. The shift is performed using this masked value.

The following example defines x as an instance of UInt8, an 8-bit, unsigned integer type. If you use 2 as the right-hand-side value in an operation on x, the shift amount requires no masking.

let x: UInt8 = 30                 // 0b00011110
let y = x &>> 2
// y == 7                         // 0b00000111

However, if you use 8 as the shift amount, the method first masks the shift amount to zero, and then performs the shift, resulting in no change to the original value.

let z = x &>> 8
// z == 30                        // 0b00011110

If the bit width of the shifted integer type is a power of two, masking is performed using a bitmask; otherwise, masking is performed using a modulo operation.

Parameters: lhs: The value to shift. rhs: The number of bits to shift lhs to the right. If rhs is outside the range 0..<lhs.bitWidth, it is masked to produce a value within that range.

Declaration

func &>><Other>(lhs: Self, rhs: Other) -> Self where Other : BinaryInteger

Declared In

FixedWidthInteger
func &>> <Other>(_: Self, rhs: Other)

Returns the result of shifting a value's binary representation the specified number of digits to the right, masking the shift amount to the type's bit width.

Use the masking right shift operator (&>>) when you need to perform a shift and are sure that the shift amount is in the range 0..<lhs.bitWidth. Before shifting, the masking right shift operator masks the shift to this range. The shift is performed using this masked value.

The following example defines x as an instance of UInt8, an 8-bit, unsigned integer type. If you use 2 as the right-hand-side value in an operation on x, the shift amount requires no masking.

let x: UInt8 = 30                 // 0b00011110
let y = x &>> 2
// y == 7                         // 0b00000111

However, if you use 8 as the shift amount, the method first masks the shift amount to zero, and then performs the shift, resulting in no change to the original value.

let z = x &>> 8
// z == 30                        // 0b00011110

If the bit width of the shifted integer type is a power of two, masking is performed using a bitmask; otherwise, masking is performed using a modulo operation.

Parameters: lhs: The value to shift. rhs: The number of bits to shift lhs to the right. If rhs is outside the range 0..<lhs.bitWidth, it is masked to produce a value within that range.

Declaration

func &>><Other>(lhs: Self, rhs: Other) -> Self where Other : BinaryInteger

Declared In

FixedWidthInteger
func &>> <Other>(_: Self, rhs: Other)

Returns the result of shifting a value's binary representation the specified number of digits to the right, masking the shift amount to the type's bit width.

Use the masking right shift operator (&>>) when you need to perform a shift and are sure that the shift amount is in the range 0..<lhs.bitWidth. Before shifting, the masking right shift operator masks the shift to this range. The shift is performed using this masked value.

The following example defines x as an instance of UInt8, an 8-bit, unsigned integer type. If you use 2 as the right-hand-side value in an operation on x, the shift amount requires no masking.

let x: UInt8 = 30                 // 0b00011110
let y = x &>> 2
// y == 7                         // 0b00000111

However, if you use 8 as the shift amount, the method first masks the shift amount to zero, and then performs the shift, resulting in no change to the original value.

let z = x &>> 8
// z == 30                        // 0b00011110

If the bit width of the shifted integer type is a power of two, masking is performed using a bitmask; otherwise, masking is performed using a modulo operation.

Parameters: lhs: The value to shift. rhs: The number of bits to shift lhs to the right. If rhs is outside the range 0..<lhs.bitWidth, it is masked to produce a value within that range.

Declaration

func &>><Other>(lhs: Self, rhs: Other) -> Self where Other : BinaryInteger

Declared In

FixedWidthInteger
func &>> <Other>(_: Self, rhs: Other)

Returns the result of shifting a value's binary representation the specified number of digits to the right, masking the shift amount to the type's bit width.

Use the masking right shift operator (&>>) when you need to perform a shift and are sure that the shift amount is in the range 0..<lhs.bitWidth. Before shifting, the masking right shift operator masks the shift to this range. The shift is performed using this masked value.

The following example defines x as an instance of UInt8, an 8-bit, unsigned integer type. If you use 2 as the right-hand-side value in an operation on x, the shift amount requires no masking.

let x: UInt8 = 30                 // 0b00011110
let y = x &>> 2
// y == 7                         // 0b00000111

However, if you use 8 as the shift amount, the method first masks the shift amount to zero, and then performs the shift, resulting in no change to the original value.

let z = x &>> 8
// z == 30                        // 0b00011110

If the bit width of the shifted integer type is a power of two, masking is performed using a bitmask; otherwise, masking is performed using a modulo operation.

Parameters: lhs: The value to shift. rhs: The number of bits to shift lhs to the right. If rhs is outside the range 0..<lhs.bitWidth, it is masked to produce a value within that range.

Declaration

func &>><Other>(lhs: Self, rhs: Other) -> Self where Other : BinaryInteger

Declared In

FixedWidthInteger
func &>> <Other>(_: Self, rhs: Other)

Returns the result of shifting a value's binary representation the specified number of digits to the right, masking the shift amount to the type's bit width.

Use the masking right shift operator (&>>) when you need to perform a shift and are sure that the shift amount is in the range 0..<lhs.bitWidth. Before shifting, the masking right shift operator masks the shift to this range. The shift is performed using this masked value.

The following example defines x as an instance of UInt8, an 8-bit, unsigned integer type. If you use 2 as the right-hand-side value in an operation on x, the shift amount requires no masking.

let x: UInt8 = 30                 // 0b00011110
let y = x &>> 2
// y == 7                         // 0b00000111

However, if you use 8 as the shift amount, the method first masks the shift amount to zero, and then performs the shift, resulting in no change to the original value.

let z = x &>> 8
// z == 30                        // 0b00011110

If the bit width of the shifted integer type is a power of two, masking is performed using a bitmask; otherwise, masking is performed using a modulo operation.

Parameters: lhs: The value to shift. rhs: The number of bits to shift lhs to the right. If rhs is outside the range 0..<lhs.bitWidth, it is masked to produce a value within that range.

Declaration

func &>><Other>(lhs: Self, rhs: Other) -> Self where Other : BinaryInteger

Declared In

FixedWidthInteger