## Operator: &<<=

``` operator &<<= { associativity right precedence assignment }```

### Declarations

func &<<=(_: inout Int, rhs: Int)

Returns the result of shifting a value's binary representation the specified number of digits to the left, masking the shift amount to the type's bit width, and stores the result in the left-hand-side variable.

The `&<<=` operator performs a masking shift, where the value used as `rhs` is masked to produce a value in the range `0..<lhs.bitWidth`. 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.

``````var x: UInt8 = 30                 // 0b00011110
x &<<= 2
// x == 120                       // 0b01111000``````

However, if you pass `19` as `rhs`, the method first bitmasks `rhs` to `3`, and then uses that masked value as the number of bits to shift `lhs`.

``````var y: UInt8 = 30                 // 0b00011110
y &<<= 19
// y == 240                       // 0b11110000``````

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

#### Declaration

`func &<<=(lhs: inout Int, rhs: Int)`

#### Declared In

`Int`, `FixedWidthInteger`
func &<<=(_: inout Int8, rhs: Int8)

Returns the result of shifting a value's binary representation the specified number of digits to the left, masking the shift amount to the type's bit width, and stores the result in the left-hand-side variable.

The `&<<=` operator performs a masking shift, where the value used as `rhs` is masked to produce a value in the range `0..<lhs.bitWidth`. 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.

``````var x: UInt8 = 30                 // 0b00011110
x &<<= 2
// x == 120                       // 0b01111000``````

However, if you pass `19` as `rhs`, the method first bitmasks `rhs` to `3`, and then uses that masked value as the number of bits to shift `lhs`.

``````var y: UInt8 = 30                 // 0b00011110
y &<<= 19
// y == 240                       // 0b11110000``````

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

#### Declaration

`func &<<=(lhs: inout Int8, rhs: Int8)`

#### Declared In

`Int8`, `FixedWidthInteger`
func &<<=(_: inout Int16, rhs: Int16)

Returns the result of shifting a value's binary representation the specified number of digits to the left, masking the shift amount to the type's bit width, and stores the result in the left-hand-side variable.

The `&<<=` operator performs a masking shift, where the value used as `rhs` is masked to produce a value in the range `0..<lhs.bitWidth`. 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.

``````var x: UInt8 = 30                 // 0b00011110
x &<<= 2
// x == 120                       // 0b01111000``````

However, if you pass `19` as `rhs`, the method first bitmasks `rhs` to `3`, and then uses that masked value as the number of bits to shift `lhs`.

``````var y: UInt8 = 30                 // 0b00011110
y &<<= 19
// y == 240                       // 0b11110000``````

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

#### Declaration

`func &<<=(lhs: inout Int16, rhs: Int16)`

#### Declared In

`Int16`, `FixedWidthInteger`
func &<<=(_: inout Int32, rhs: Int32)

Returns the result of shifting a value's binary representation the specified number of digits to the left, masking the shift amount to the type's bit width, and stores the result in the left-hand-side variable.

The `&<<=` operator performs a masking shift, where the value used as `rhs` is masked to produce a value in the range `0..<lhs.bitWidth`. 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.

``````var x: UInt8 = 30                 // 0b00011110
x &<<= 2
// x == 120                       // 0b01111000``````

However, if you pass `19` as `rhs`, the method first bitmasks `rhs` to `3`, and then uses that masked value as the number of bits to shift `lhs`.

``````var y: UInt8 = 30                 // 0b00011110
y &<<= 19
// y == 240                       // 0b11110000``````

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

#### Declaration

`func &<<=(lhs: inout Int32, rhs: Int32)`

#### Declared In

`Int32`, `FixedWidthInteger`
func &<<=(_: inout Int64, rhs: Int64)

Returns the result of shifting a value's binary representation the specified number of digits to the left, masking the shift amount to the type's bit width, and stores the result in the left-hand-side variable.

The `&<<=` operator performs a masking shift, where the value used as `rhs` is masked to produce a value in the range `0..<lhs.bitWidth`. 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.

``````var x: UInt8 = 30                 // 0b00011110
x &<<= 2
// x == 120                       // 0b01111000``````

However, if you pass `19` as `rhs`, the method first bitmasks `rhs` to `3`, and then uses that masked value as the number of bits to shift `lhs`.

``````var y: UInt8 = 30                 // 0b00011110
y &<<= 19
// y == 240                       // 0b11110000``````

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

#### Declaration

`func &<<=(lhs: inout Int64, rhs: Int64)`

#### Declared In

`Int64`, `FixedWidthInteger`
func &<<=(_: inout UInt, rhs: UInt)

Returns the result of shifting a value's binary representation the specified number of digits to the left, masking the shift amount to the type's bit width, and stores the result in the left-hand-side variable.

The `&<<=` operator performs a masking shift, where the value used as `rhs` is masked to produce a value in the range `0..<lhs.bitWidth`. 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.

``````var x: UInt8 = 30                 // 0b00011110
x &<<= 2
// x == 120                       // 0b01111000``````

However, if you pass `19` as `rhs`, the method first bitmasks `rhs` to `3`, and then uses that masked value as the number of bits to shift `lhs`.

``````var y: UInt8 = 30                 // 0b00011110
y &<<= 19
// y == 240                       // 0b11110000``````

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

#### Declaration

`func &<<=(lhs: inout UInt, rhs: UInt)`

#### Declared In

`UInt`, `FixedWidthInteger`
func &<<=(_: inout UInt8, rhs: UInt8)

Returns the result of shifting a value's binary representation the specified number of digits to the left, masking the shift amount to the type's bit width, and stores the result in the left-hand-side variable.

The `&<<=` operator performs a masking shift, where the value used as `rhs` is masked to produce a value in the range `0..<lhs.bitWidth`. 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.

``````var x: UInt8 = 30                 // 0b00011110
x &<<= 2
// x == 120                       // 0b01111000``````

However, if you pass `19` as `rhs`, the method first bitmasks `rhs` to `3`, and then uses that masked value as the number of bits to shift `lhs`.

``````var y: UInt8 = 30                 // 0b00011110
y &<<= 19
// y == 240                       // 0b11110000``````

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

#### Declaration

`func &<<=(lhs: inout UInt8, rhs: UInt8)`

#### Declared In

`UInt8`, `FixedWidthInteger`
func &<<=(_: inout UInt16, rhs: UInt16)

Returns the result of shifting a value's binary representation the specified number of digits to the left, masking the shift amount to the type's bit width, and stores the result in the left-hand-side variable.

The `&<<=` operator performs a masking shift, where the value used as `rhs` is masked to produce a value in the range `0..<lhs.bitWidth`. 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.

``````var x: UInt8 = 30                 // 0b00011110
x &<<= 2
// x == 120                       // 0b01111000``````

However, if you pass `19` as `rhs`, the method first bitmasks `rhs` to `3`, and then uses that masked value as the number of bits to shift `lhs`.

``````var y: UInt8 = 30                 // 0b00011110
y &<<= 19
// y == 240                       // 0b11110000``````

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

#### Declaration

`func &<<=(lhs: inout UInt16, rhs: UInt16)`

#### Declared In

`UInt16`, `FixedWidthInteger`
func &<<=(_: inout UInt32, rhs: UInt32)

Returns the result of shifting a value's binary representation the specified number of digits to the left, masking the shift amount to the type's bit width, and stores the result in the left-hand-side variable.

The `&<<=` operator performs a masking shift, where the value used as `rhs` is masked to produce a value in the range `0..<lhs.bitWidth`. 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.

``````var x: UInt8 = 30                 // 0b00011110
x &<<= 2
// x == 120                       // 0b01111000``````

However, if you pass `19` as `rhs`, the method first bitmasks `rhs` to `3`, and then uses that masked value as the number of bits to shift `lhs`.

``````var y: UInt8 = 30                 // 0b00011110
y &<<= 19
// y == 240                       // 0b11110000``````

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

#### Declaration

`func &<<=(lhs: inout UInt32, rhs: UInt32)`

#### Declared In

`UInt32`, `FixedWidthInteger`
func &<<=(_: inout UInt64, rhs: UInt64)

Returns the result of shifting a value's binary representation the specified number of digits to the left, masking the shift amount to the type's bit width, and stores the result in the left-hand-side variable.

The `&<<=` operator performs a masking shift, where the value used as `rhs` is masked to produce a value in the range `0..<lhs.bitWidth`. 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.

``````var x: UInt8 = 30                 // 0b00011110
x &<<= 2
// x == 120                       // 0b01111000``````

However, if you pass `19` as `rhs`, the method first bitmasks `rhs` to `3`, and then uses that masked value as the number of bits to shift `lhs`.

``````var y: UInt8 = 30                 // 0b00011110
y &<<= 19
// y == 240                       // 0b11110000``````

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

#### Declaration

`func &<<=(lhs: inout UInt64, rhs: UInt64)`

#### Declared In

`UInt64`, `FixedWidthInteger`