Arithmetic Internals

Code location: SUBSECTION 15.2 in flowlog.c.

Integer representation

Flowlog uses a two-tier integer model:

Bigint layout

struct pl_bigint {
  int sign;      // -1, 0, +1
  ULO len;       // number of limbs
  uint32_t limbs[len];  // little-endian base-2^32 limbs
}

Notes: - Limbs are little-endian (limbs[0] is the least-significant 32 bits). - The base is 2^32, so each limb stores 32 bits. - Bigints are normalized: no leading zero limbs; zero is represented as sign=0, len=0.

Promotion and canonicalization

Arithmetic operators

Shifts and bitwise operators

Parsing and printing

Floating-point interop

Memory and parallel safety

Potential future optimizations