Content deleted Content added
Stevebroshar (talk | contribs) →Table structure: Edit for brevity |
Stevebroshar (talk | contribs) →Table structure: Remove fluff; don't need to tell folks what both dec and hex are |
||
Line 24:
|+ Table that map each ASCII value (A,D,M,S) to a subroutine index (1,4,3,2) via a one-dimensional array<br/>{{nobold|(omitted values are shown as '...')}}
|- style="vertical-align:bottom;"
!
|-
|
|-
|
|-
|
|-
|-
|-
|-
|-
|-
|}
In perhaps its simplest implementation, a control table may sometimes be a one-dimensional table for ''directly'' translating a [[raw data]] value to a corresponding subroutine [[offset (computer science)|offset]], [[array data structure|index]] or [[pointer (computer programming)|pointer]] using the raw data value either directly as the index to the array, or by performing some basic arithmetic on the data beforehand. This can be achieved in [[constant time]] (without a [[linear search]] or [[binary search]] using a typical [[lookup table]] on an [[associative array]]). In most [[computer architecture|architecture]]s, this can be accomplished in two or three [[machine instruction]]s – without any comparisons or loops. The technique is known as a "[[trivial hash function]]" or, when used specifically for branch tables, "[[double dispatch]]".
|