# OpUserOffset

## Description

Convert the current operand to an offset with any base. If the cursor is on the first operand (the cursor is before ',') then the first operand will be affected; otherwise, all other operands will be affected. If the offset base is specified as 0xFFFFFFFF, then IDA will create "an automatic offset". Automatic offsets mean that the actual value of the base will be calculated by IDA.

The following offset attributes are available:

| Option                                     | Description                                                                                                                                                                                                                                                                                                                                                    |
| ------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Treat the base address as a plain number   | if checked, IDA will treat the base address as a number. In this case, IDA will not create a cross-reference to it and the base address will be printed as a number, not as an offset expression.                                                                                                                                                              |
| Offset points past the main object         | Offsets of this type point past an object end. They do not cause an object created/deletion.                                                                                                                                                                                                                                                                   |
| Use image base as offset base              | These offsets are based on the image base. There is no need to explicitly specify the offset base. These offsets are displayed in a concise form: `rva func` instead of `offset func - imagebase`. If you intend to reassemble the output file, execute the following IDC statement: `set_inf_attr(INF_GENFLAGS, get_inf_attr(INF_GENFLAGS) & ~INFFL_ALLASM);` |
| Subtract operand value                     | Use this option when the operand value should be substracted from the base to get the target address. In this case the displayed expression will be displayed as `offset base - target` instead of the usual `offset target - base`                                                                                                                            |
| Signed operand                             | Use this option if the operand should be interpreted as a signed value. This option is only available for OFF\_REF8, OFF\_REF16, OFF\_REF32 and OFF\_REF64 offset types.                                                                                                                                                                                       |
| Operand value of 0 is invalid              | If the operand value is 0, the value will be highlighted in red.                                                                                                                                                                                                                                                                                               |
| Operand value of NOT 0 is invalid          | If the operand value is zero's complement (i.e. all bits are set), the value will be highlighted in red. For example a OFF\_REF16 with an operand value of 0xFFFF would be invalid.                                                                                                                                                                            |
| Use the current address as the offset base | The offset base is dynamically calculated and is equal to the address of the current element: - for standalone items: their start address - for arrays: the start of the array element - for structures: the start of the structure field                                                                                                                      |

The offset expression is displayed in the following concise form: offset target - $ where "$" denotes the start of the element (and is assembler-dependent).

To create offsets to structure members use the Offset (struct)... command (action `OpStructOffset`).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hex-rays.com/ida-actions/opuseroffset.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
