1.0.2 • Published 9 years ago

formula-address-system v1.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

address system

The address system maps a two dimensional table to a single dimension.

The cell index encodes both the row and the column into a single integer.

The cell index is a value between 0 and 17179869183.

The max value is the binary number '1111111111111111111111111111111111'.

The first 20 bits from left-to-right are the row index; from 0...MAX_ROWS-1.

The remaining 14 bits are the column index; from 0...MAX_COLS-1.

functions

  1. CELLINDEX(row, col)
  2. INDEX2ADDR(index)
  3. INDEX2ROW(index)
  4. INDEX2COL(index)

caveats

Since JavaScript doesn't have an unsigned shift left I was forced to resort to multiplication which is less efficient but will have to do. If you can do fast binary math in JavaScript then please send me a pull request.