---
spec: JVMS
title: "The Java Virtual Machine Specification"
edition: "Java SE 15 Edition"
java_version: 15
chapter: "Chapter 6. The Java Virtual Machine Instruction Set"
section: "6.5.lshr"
heading: "lshr"
parent: "6.5. Instructions"
source: https://docs.oracle.com/javase/specs/jvms/se15/html/jvms-6.html#jvms-6.5.lshr
id: "6.5.lshr"
url: https://jvm.obfuscated.software/jvms/se15/6.5.lshr.html
raw: https://jvm.obfuscated.software/jvms/se15/6.5.lshr.md
---

# lshr

## Operation

Arithmetic shift right `long`

## Format

```
lshr
```

## Forms

*lshr* = 123 (0x7b)

## Operand Stack

..., *value1*, *value2* →

..., *result*

## Description

The *value1* must be of type `long`, and *value2* must be of type `int`. The values are popped from the operand stack. A `long` *result* is calculated by shifting *value1* right by *s* bit positions, with sign extension, where *s* is the value of the low 6 bits of *value2*. The *result* is pushed onto the operand stack.

## Notes

The resulting value is *floor*(*value1* / 2^s), where *s* is *value2* & 0x3f. For non-negative *value1*, this is equivalent to truncating `long` division by 2 to the power *s*. The shift distance actually used is therefore always in the range 0 to 63, inclusive, as if *value2* were subjected to a bitwise logical AND with the mask value 0x3f.
