BRANCH (COMPUTER SCIENCE)


A 'branch' (or 'jump' on some computer architectures, such as the PDP-8 and Intel x86) is a point in a computer program where the flow of control is altered. The term branch is usually used when referring to a program written in machine code or assembly language; in a high-level programming language, branches usually take the form of conditional statements, subroutine calls or GOTO statements. An instruction that causes a branch, a branch instruction, can be ''taken'' or ''not taken'': if a branch is not taken, the flow of control is unchanged and the next instruction to be executed is the instruction immediately following the current instruction in memory; if taken, the next instruction to be executed is an instruction at some other place in memory. There are two usual forms of branch instruction: a ''conditional branch'' that can be either taken or not taken, depending on a condition such as a CPU flag, and an ''unconditional branch'' which is always taken.

Contents
Examples
See also

Examples


An unconditional branch in Intel assembly language:
jmp 0x00100000
A conditional branch in Intel assembly language:
jz 0x00100000

See also



Control flow

Branch delay slot

Branch predictor

Branch table

Indirect branch

Instruction pipeline

This article provided by Wikipedia. To edit the contents of this article, click here for original source.

psst.. try this: add to faves