# ridiculousfish/libdivide

Official git repository for libdivide: optimized integer division

Repository: https://github.com/ridiculousfish/libdivide
Canonical: https://ross.abutalabs.com/products/libdivide
Homepage: http://libdivide.com
Language: C++
License: NOASSERTION
License Family: other
Last push: 2026-08-21T16:28:56+00:00

## Health v2 (maintenance only)
Score: 78/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 98, release rhythm 39, longevity 100
- inputs: {"age_days": 5482, "days_push": 12, "days_rel": 198, "gap_med": 386, "n_releases_24m": 2}
- flags: no_license
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1348, forks 98 (observed 2026-08-28T04:04:27.765357+00:00)

## What it is
libdivide is a single-header C/C++ library that replaces expensive integer division instructions with precomputed multiply-and-shift sequences, speeding up division by a runtime constant by up to 10x. It also supports SIMD vector division (SSE2, AVX2, AVX512, NEON, SVE) and runs on 8-bit microcontrollers like AVR.

## Use cases
- speed up dividing many integers by a runtime constant
- optimize hash table bucket index computation
- accelerate scaling algorithms with integer division
- fast integer division in an interpreter loop
- divide SIMD vectors by a constant since SIMD lacks integer division
- fast division on microcontrollers without a hardware divider

## When to choose
- you divide many numerators by the same runtime divisor in a hot loop
- you need SIMD integer division that hardware doesn't provide
- you target embedded hardware lacking a hardware divider
- you want a dependency-free, permissively licensed header-only optimization

## When to avoid
- the divisor changes on every division (precomputation overhead dominates)
- you only divide by compile-time constants (compilers already optimize this)
- divisions are rare and not performance-critical

## Facets
- artifact type: library
- maturity: stable
- function: math, developer-tools
- domain: performance, developer-tools
- platform: cpp, c, cross-platform, embedded
- tags: header-only, integer-division, simd, optimization, branchless, algorithms, gpu

## Member repositories
- ridiculousfish/libdivide (main) score 78

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:27.765357+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T04:42:26.617546+00:00, confidence not recorded.
  - readme: https://github.com/ridiculousfish/libdivide (fetched 2026-08-28T04:04:27.765357+00:00, sha 42953bd196eb)
  - homepage: http://libdivide.com (fetched 2026-08-29T12:01:26.834853+00:00, sha de69bc973f80)
  - site_page: http://libdivide.com/documentation.html (fetched 2026-08-29T12:01:26.843977+00:00, sha 520ad0ef9721)
- Data as of 2026-08-30T08:39:29.467469+00:00.
