# compiler/ic/bitabs

Dark Mode

- Index

Search:
Group by:
Source Edit

A BiTable is a table that can be seen as an optimized pair of (Table[LitId, Val], Table[Val, LitId]).

# Imports

rodfiles

# Types

    BiTable[T] = object
      vals: seq[T]
      keys: seq[LitId]

  Source Edit

    LitId = distinct uint32

  Source Edit

# Procs

    proc `$`(x: LitId): string {.borrow, ...raises: [], tags: [].}

  Source Edit

    proc `<=`(x, y: LitId): bool {.borrow, ...raises: [], tags: [].}

  Source Edit

    proc `<`(x, y: LitId): bool {.borrow, ...raises: [], tags: [].}

  Source Edit

    proc `==`(x, y: LitId): bool {.borrow, ...raises: [], tags: [].}

  Source Edit

    proc `[]`[T](t: BiTable[T]; litId: LitId): lent T {.inline.}

  Source Edit

    proc `[]`[T](t: var BiTable[T]; litId: LitId): var T {.inline.}

  Source Edit

    proc getKeyId[T](t: BiTable[T]; v: T): LitId

  Source Edit

    proc getOrIncl[T](t: var BiTable[T]; v: T): LitId

  Source Edit

    proc hash(x: LitId): Hash {.borrow, ...raises: [], tags: [].}

  Source Edit

    proc hash[T](t: BiTable[T]): Hash

  as the keys are hashes of the values, we simply use them instead Source Edit

    proc hasLitId[T](t: BiTable[T]; x: LitId): bool

  Source Edit

    proc len[T](t: BiTable[T]): int

  Source Edit

    proc load[T](f: var RodFile; t: var BiTable[T])

  Source Edit

    proc store[T](f: var RodFile; t: BiTable[T])

  Source Edit