← Back to Pull requests

Use `int64_t` instead of `long` in `synapses_create_generator.cpp` (fixes #1899) #1905

Closed
unknown closed this pull request without merging on Oct 28, 2026 10:49 UTC
View on GitHub
unknown unknown commented on Oct 27, 2026 16:10 UTC
Author

Fixes #1899.

The C++ standalone template for synapse creation declared the iteration variables as long. On macOS, int64_t is long long, so _higher_type has no specialisation for long, and % or // on j or k in Synapses.connect failed to compile (no matching function for call to '_brian_mod'). As suggested in the issue, this replaces every long in synapses_create_generator.cpp with int64_t. On Linux, where int64_t is long, the generated code is unchanged.

Tests

New cases in the existing test_synapse_generator_deterministic and test_synapse_generator_deterministic_over_postsynaptic:

  • generator expressions with k % 2 == 0 and k // 4 == i // 4 (and the j versions when iterating over the presynaptic side)

  • conditions (i + j) % 3 != 0 and j // 4 == i // 4
  • Each result is compared with the expected connectivity matrix computed with numpy.

    On macOS (arm64, Apple clang 21.0.0, Python 3.13):

  • Without the template change, both tests fail on cpp_standalone with no matching function for call to '_brian_mod' / '_brian_floordiv'.

  • With the change, both tests pass on numpy, cython and cpp_standalone.

  • Full cpp_standalone test suite, including long tests (brian2.test([], test_standalone="cpp_standalone", long_tests=True)): 270 passed, 2 skipped, no failures. This includes test_synapse_generator_deterministic_2, which also uses this template.

  • cpp_standalone tests matching synapse with float_dtype=float32: 72 passed, no failures.

  • ruff format --check (v0.14.2) reports no changes.
  • I haven't tested on Windows or Linux locally, so I'm relying on CI for those.

    Diff: 206 lines (+154 / -52) across 2 files Reviewer: mstimberg Review duration: 1119m
    All Vouch review confidence checks passed
    Residual risk 0.14 = Change Risk (0.36) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.36 · 206 lines diff across 2 files
    0.36
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.319
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #1905"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 36.4% (MEDIUM) · Higher = larger blast radius
    36.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 14.4% · Safe to merge
    14.4%