| IDA SDK

Macros
Switch info flags

## Detailed Description

Used by switch_info_t::flags.

## Macros
#define | SWI_SPARSE 0x00000001
| sparse switch (value table present), otherwise lowcase present
#define | SWI_V32 0x00000002
| 32-bit values in table
#define | SWI_J32 0x00000004
| 32-bit jump offsets
#define | SWI_VSPLIT 0x00000008
| value table is split (only for 32-bit values)
#define | SWI_USER 0x00000010
| user specified switch (starting from version 2)
#define | SWI_DEF_IN_TBL 0x00000020
| default case is an entry in the jump table. More...
#define | SWI_JMP_INV 0x00000040
| jumptable is inversed. More...
#define | SWI_SHIFT_MASK 0x00000180
| use formula (element<<shift) + elbase to find jump targets
#define | SWI_ELBASE 0x00000200
| elbase is present (otherwise the base of the switch segment will be used)
#define | SWI_JSIZE 0x00000400
| jump offset expansion bit
#define | SWI_VSIZE 0x00000800
| value table element size expansion bit
#define | SWI_SEPARATE 0x00001000
| create an array of individual elements (otherwise separate items)
#define | SWI_SIGNED 0x00002000
| jump table entries are signed
#define | SWI_CUSTOM 0x00004000
| custom jump table. More...
#define | SWI_INDIRECT 0x00010000
| value table elements are used as indexes into the jump table (for sparse switches)
#define | SWI_SUBTRACT 0x00020000
| table values are subtracted from the elbase instead of being added
#define | SWI_HXNOLOWCASE 0x00040000
| lowcase value should not be used by the decompiler (internal flag)
#define | SWI_STDTBL 0x00080000
| custom jump table with standard table formatting. More...
#define | SWI_DEFRET 0x00100000
| return in the default case (defjump==BADADDR)
#define | SWI_SELFREL 0x00200000
| jump address is relative to the element not to ELBASE
#define | SWI_JMPINSN 0x00400000
| jump table entries are insns. More...
#define | SWI_VERSION 0x00800000
| the structure contains the VERSION member

## Macro Definition Documentation

## ◆ SWI_DEF_IN_TBL

#define SWI_DEF_IN_TBL 0x00000020

default case is an entry in the jump table.

This flag is applicable in 2 cases:

- The sparse indirect switch (i.e. a switch with a values table) {jump table size} == {value table size} + 1. The default case entry is the last one in the table (or the first one in the case of an inversed jump table).
- The switch with insns in the jump table. The default case entry is before the first entry of the table.
  See also the find_defjump_from_table() helper function.

## ◆ SWI_JMP_INV

#define SWI_JMP_INV 0x00000040

jumptable is inversed.

(last entry is for first entry in values table)

## ◆ SWI_CUSTOM

#define SWI_CUSTOM 0x00004000

custom jump table.

processor_t::create_switch_xrefs will be called to create code xrefs for the table. Custom jump table must be created by the module (see also SWI_STDTBL)

## ◆ SWI_STDTBL

#define SWI_STDTBL 0x00080000

custom jump table with standard table formatting.

ATM IDA doesn't use SWI_CUSTOM for switches with standard table formatting. So this flag can be considered as obsolete.

## ◆ SWI_JMPINSN

#define SWI_JMPINSN 0x00400000

jump table entries are insns.

For such entries SHIFT has a different meaning. It denotes the number of insns in the entry. For example, 0 - the entry contains the jump to the case, 1 - the entry contains one insn like a 'mov' and jump to the end of case, and so on.